Theorem: LRAT.DefaultClause.ofArray_eq (LeanSAT/LRAT/Clause.lean)

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
⊢ ofArray arr = some c → c.toList = arr.toList
Tactic:
intro h
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h : ofArray arr = some c
⊢ c.toList = arr.toList

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h : ofArray arr = some c
⊢ c.toList = arr.toList
Tactic:
simp only [ofArray] at h
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
⊢ c.toList = arr.toList

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
⊢ c.toList = arr.toList
Tactic:
rw [toList, Array.toList_eq]
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
⊢ c.clause = arr.data

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
⊢ c.clause = arr.data
Tactic:
let motive (idx : Nat) (acc : Option (DefaultClause n)) : Prop :=
  ∃ idx_le_arr_size : idx ≤ arr.size, ∀ c' : DefaultClause n, acc = some c' →
    ∃ hsize : c'.clause.length = arr.size - idx, ∀ i : Fin c'.clause.length,
    have idx_in_bounds : idx + i.1 < arr.size := by
      omega
    List.get c'.clause i = arr[idx + i]'idx_in_bounds
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
⊢ c.clause = arr.data

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
⊢ c.clause = arr.data
Tactic:
have h_base : motive arr.size (some empty) := by
  apply Exists.intro $ Nat.le_refl arr.size
  intro c' heq
  simp only [Option.some.injEq] at heq
  have hsize : List.length c'.clause = arr.size- arr.size := by
    simp [← heq, empty]
  apply Exists.intro hsize
  intro i
  simp only [← heq, empty, List.length_nil] at i
  exact Fin.elim0 i
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
⊢ c.clause = arr.data

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
⊢ c.clause = arr.data
Tactic:
let fold_fn (l : Literal (PosFin n)) (acc : Option (DefaultClause n)) : Option (DefaultClause n) :=
  match acc with
  | none => none
  | some acc => acc.insert l
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
⊢ c.clause = arr.data

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
⊢ c.clause = arr.data
Tactic:
have h_inductive (idx : Fin arr.size) (acc : Option (DefaultClause n)) (ih : motive (idx.1 + 1) acc) :
  motive idx.1 (fold_fn arr[idx] acc) := by
  rcases ih with ⟨idx_add_one_le_arr_size, ih⟩
  apply Exists.intro $ Nat.le_of_succ_le idx_add_one_le_arr_size
  intro c' heq
  simp only [Fin.getElem_fin, fold_fn] at heq
  split at heq
  . simp only at heq
  . next acc =>
    specialize ih acc rfl
    rcases ih with ⟨hsize, ih⟩
    simp only at ih
    simp only [insert] at heq
    split at heq
    . exact False.elim heq
    . split at heq
      . next h_dup =>
        exfalso simp only [List.contains] at h_dup
        rcases List.get_of_mem $ List.mem_of_elem_eq_true h_dup with ⟨j, hj⟩
        specialize ih j
        rw [hj] at ih
        have idx_add_one_add_j_in_bounds : idx.1 + 1 + j.1 < arr.size := by
          omega
        have idx_ne_idx_add_one_add_j_in_bounds : idx.1 ≠ idx.1 + 1 + j.1 := by
          omega
        exact arrNodup idx ⟨idx.1 + 1 + j.1, idx_add_one_add_j_in_bounds⟩ idx_ne_idx_add_one_add_j_in_bounds ih
      . simp only [Option.some.injEq] at heq
        have hsize' : c'.clause.length = arr.size - idx.1 := by
          simp only [← heq, List.length_cons, hsize]
          rw [Nat.succ_eq_add_one, Nat.sub_add_eq, Nat.sub_add_cancel]
          apply Nat.le_sub_of_add_le
          rw [Nat.add_comm]
          exact idx_add_one_le_arr_size
        apply Exists.intro hsize'
        intro i
        simp only
        have lhs_rw : c'.clause = arr[idx.1] :: acc.clause := by rw [← heq]
        simp only [List.get_of_eq lhs_rw]
        by_cases i.1 = 0
        . next i_eq_zero =>
          simp only [List.length_cons, i_eq_zero, List.get, Nat.add_zero]
        . next i_ne_zero =>
          rcases Nat.exists_eq_succ_of_ne_zero i_ne_zero with ⟨j, hj⟩
          simp only [List.length_cons, hj, List.get, Nat.succ_eq_add_one]
          simp only [Nat.add_comm j 1, ← Nat.add_assoc]
          exact ih ⟨j, by omega⟩
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
⊢ c.clause = arr.data

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
⊢ c.clause = arr.data
Tactic:
rcases (Array.foldr_induction motive h_base h_inductive).2 c h with ⟨hsize, h⟩
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
h :
  ∀ (i : Fin c.clause.length),
    let_fun idx_in_bounds := ⋯;
    c.clause.get i = arr[0 + ↑i]
⊢ c.clause = arr.data

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
h :
  ∀ (i : Fin c.clause.length),
    let_fun idx_in_bounds := ⋯;
    c.clause.get i = arr[0 + ↑i]
⊢ c.clause = arr.data
Tactic:
ext
State after:
case intro.a.a
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
h :
  ∀ (i : Fin c.clause.length),
    let_fun idx_in_bounds := ⋯;
    c.clause.get i = arr[0 + ↑i]
n✝ : Nat
a✝ : Literal (PosFin n)
⊢ a✝ ∈ c.clause.get? n✝ ↔ a✝ ∈ arr.data.get? n✝

State before:
case intro.a.a
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
h :
  ∀ (i : Fin c.clause.length),
    let_fun idx_in_bounds := ⋯;
    c.clause.get i = arr[0 + ↑i]
n✝ : Nat
a✝ : Literal (PosFin n)
⊢ a✝ ∈ c.clause.get? n✝ ↔ a✝ ∈ arr.data.get? n✝
Tactic:
next i l =>
by_cases i_in_bounds : i < c.clause.length
. specialize h ⟨i, i_in_bounds⟩
  simp only at h
  have i_in_bounds' : i < arr.data.length := by
    dsimp; omega
  rw [List.get?_eq_get i_in_bounds, List.get?_eq_get i_in_bounds']
  simp only [h, Nat.zero_add, Array.getElem_eq_data_get, Option.mem_def, Option.some.injEq]
. have arr_data_length_le_i : arr.data.length ≤ i := by
    dsimp; omega
  simp only [Nat.not_lt, ← List.get?_eq_none] at i_in_bounds arr_data_length_le_i
  rw [i_in_bounds, arr_data_length_le_i]
State after:
no goals

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
idx : Nat
acc : Option (DefaultClause n)
idx_le_arr_size : idx ≤ arr.size
c' : DefaultClause n
hsize : c'.clause.length = arr.size - idx
i : Fin c'.clause.length
⊢ idx + ↑i < arr.size
Tactic:
omega
State after:
no goals

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
⊢ motive arr.size (some empty)
Tactic:
apply Exists.intro $ Nat.le_refl arr.size
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
⊢ ∀ (c' : DefaultClause n),
    some empty = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[arr.size + ↑i]

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
⊢ ∀ (c' : DefaultClause n),
    some empty = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[arr.size + ↑i]
Tactic:
intro c' heq
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
c' : DefaultClause n
heq : some empty = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[arr.size + ↑i]

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
c' : DefaultClause n
heq : some empty = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[arr.size + ↑i]
Tactic:
simp only [Option.some.injEq] at heq
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
c' : DefaultClause n
heq : empty = c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[arr.size + ↑i]

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
c' : DefaultClause n
heq : empty = c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[arr.size + ↑i]
Tactic:
have hsize : List.length c'.clause = arr.size- arr.size := by
  simp [← heq, empty]
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
c' : DefaultClause n
heq : empty = c'
hsize : c'.clause.length = arr.size - arr.size
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[arr.size + ↑i]

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
c' : DefaultClause n
heq : empty = c'
hsize : c'.clause.length = arr.size - arr.size
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[arr.size + ↑i]
Tactic:
apply Exists.intro hsize
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
c' : DefaultClause n
heq : empty = c'
hsize : c'.clause.length = arr.size - arr.size
⊢ ∀ (i : Fin c'.clause.length),
    let_fun idx_in_bounds := ⋯;
    c'.clause.get i = arr[arr.size + ↑i]

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
c' : DefaultClause n
heq : empty = c'
hsize : c'.clause.length = arr.size - arr.size
⊢ ∀ (i : Fin c'.clause.length),
    let_fun idx_in_bounds := ⋯;
    c'.clause.get i = arr[arr.size + ↑i]
Tactic:
intro i
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
c' : DefaultClause n
heq : empty = c'
hsize : c'.clause.length = arr.size - arr.size
i : Fin c'.clause.length
⊢ let_fun idx_in_bounds := ⋯;
  c'.clause.get i = arr[arr.size + ↑i]

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
c' : DefaultClause n
heq : empty = c'
hsize : c'.clause.length = arr.size - arr.size
i : Fin c'.clause.length
⊢ let_fun idx_in_bounds := ⋯;
  c'.clause.get i = arr[arr.size + ↑i]
Tactic:
simp only [← heq, empty, List.length_nil] at i
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
c' : DefaultClause n
heq : empty = c'
hsize : c'.clause.length = arr.size - arr.size
i✝ : Fin c'.clause.length
i : Fin 0
⊢ let_fun idx_in_bounds := ⋯;
  c'.clause.get i✝ = arr[arr.size + ↑i✝]

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
c' : DefaultClause n
heq : empty = c'
hsize : c'.clause.length = arr.size - arr.size
i✝ : Fin c'.clause.length
i : Fin 0
⊢ let_fun idx_in_bounds := ⋯;
  c'.clause.get i✝ = arr[arr.size + ↑i✝]
Tactic:
exact Fin.elim0 i
State after:
no goals

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
c' : DefaultClause n
heq : empty = c'
⊢ c'.clause.length = arr.size - arr.size
Tactic:
simp [← heq, empty]
State after:
no goals

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
acc : Option (DefaultClause n)
ih : motive (↑idx + 1) acc
⊢ motive (↑idx) (fold_fn arr[idx] acc)
Tactic:
rcases ih with ⟨idx_add_one_le_arr_size, ih⟩
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
acc : Option (DefaultClause n)
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
ih :
  ∀ (c' : DefaultClause n),
    acc = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
⊢ motive (↑idx) (fold_fn arr[idx] acc)

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
acc : Option (DefaultClause n)
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
ih :
  ∀ (c' : DefaultClause n),
    acc = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
⊢ motive (↑idx) (fold_fn arr[idx] acc)
Tactic:
apply Exists.intro $ Nat.le_of_succ_le idx_add_one_le_arr_size
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
acc : Option (DefaultClause n)
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
ih :
  ∀ (c' : DefaultClause n),
    acc = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
⊢ ∀ (c' : DefaultClause n),
    fold_fn arr[idx] acc = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
acc : Option (DefaultClause n)
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
ih :
  ∀ (c' : DefaultClause n),
    acc = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
⊢ ∀ (c' : DefaultClause n),
    fold_fn arr[idx] acc = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + ↑i]
Tactic:
intro c' heq
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
acc : Option (DefaultClause n)
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
ih :
  ∀ (c' : DefaultClause n),
    acc = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
c' : DefaultClause n
heq : fold_fn arr[idx] acc = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
acc : Option (DefaultClause n)
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
ih :
  ∀ (c' : DefaultClause n),
    acc = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
c' : DefaultClause n
heq : fold_fn arr[idx] acc = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
simp only [Fin.getElem_fin, fold_fn] at heq
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
acc : Option (DefaultClause n)
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
ih :
  ∀ (c' : DefaultClause n),
    acc = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
c' : DefaultClause n
heq :
  (match acc with
    | none => none
    | some acc => acc.insert arr[↑idx]) =
    some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
acc : Option (DefaultClause n)
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
ih :
  ∀ (c' : DefaultClause n),
    acc = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
c' : DefaultClause n
heq :
  (match acc with
    | none => none
    | some acc => acc.insert arr[↑idx]) =
    some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
split at heq
State after:
case intro.h_1
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
ih :
  ∀ (c' : DefaultClause n),
    none = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
heq : none = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

case intro.h_2
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝¹ : Option (DefaultClause n)
acc✝ : DefaultClause n
ih :
  ∀ (c' : DefaultClause n),
    some acc✝ = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
heq : acc✝.insert arr[↑idx] = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro.h_1
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
ih :
  ∀ (c' : DefaultClause n),
    none = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
heq : none = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

case intro.h_2
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝¹ : Option (DefaultClause n)
acc✝ : DefaultClause n
ih :
  ∀ (c' : DefaultClause n),
    some acc✝ = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
heq : acc✝.insert arr[↑idx] = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
. simp only at heq
State after:
case intro.h_2
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝¹ : Option (DefaultClause n)
acc✝ : DefaultClause n
ih :
  ∀ (c' : DefaultClause n),
    some acc✝ = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
heq : acc✝.insert arr[↑idx] = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro.h_2
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝¹ : Option (DefaultClause n)
acc✝ : DefaultClause n
ih :
  ∀ (c' : DefaultClause n),
    some acc✝ = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
heq : acc✝.insert arr[↑idx] = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
. next acc =>
  specialize ih acc rfl
  rcases ih with ⟨hsize, ih⟩
  simp only at ih
  simp only [insert] at heq
  split at heq
  . exact False.elim heq
  . split at heq
    . next h_dup =>
      exfalso simp only [List.contains] at h_dup
      rcases List.get_of_mem $ List.mem_of_elem_eq_true h_dup with ⟨j, hj⟩
      specialize ih j
      rw [hj] at ih
      have idx_add_one_add_j_in_bounds : idx.1 + 1 + j.1 < arr.size := by
        omega
      have idx_ne_idx_add_one_add_j_in_bounds : idx.1 ≠ idx.1 + 1 + j.1 := by
        omega
      exact arrNodup idx ⟨idx.1 + 1 + j.1, idx_add_one_add_j_in_bounds⟩ idx_ne_idx_add_one_add_j_in_bounds ih
    . simp only [Option.some.injEq] at heq
      have hsize' : c'.clause.length = arr.size - idx.1 := by
        simp only [← heq, List.length_cons, hsize]
        rw [Nat.succ_eq_add_one, Nat.sub_add_eq, Nat.sub_add_cancel]
        apply Nat.le_sub_of_add_le
        rw [Nat.add_comm]
        exact idx_add_one_le_arr_size
      apply Exists.intro hsize'
      intro i
      simp only
      have lhs_rw : c'.clause = arr[idx.1] :: acc.clause := by rw [← heq]
      simp only [List.get_of_eq lhs_rw]
      by_cases i.1 = 0
      . next i_eq_zero =>
        simp only [List.length_cons, i_eq_zero, List.get, Nat.add_zero]
      . next i_ne_zero =>
        rcases Nat.exists_eq_succ_of_ne_zero i_ne_zero with ⟨j, hj⟩
        simp only [List.length_cons, hj, List.get, Nat.succ_eq_add_one]
        simp only [Nat.add_comm j 1, ← Nat.add_assoc]
        exact ih ⟨j, by omega⟩
State after:
no goals

State before:
case intro.h_1
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
ih :
  ∀ (c' : DefaultClause n),
    none = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
heq : none = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
simp only at heq
State after:
no goals

State before:
case intro.h_2
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝¹ : Option (DefaultClause n)
acc✝ : DefaultClause n
ih :
  ∀ (c' : DefaultClause n),
    some acc✝ = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
heq : acc✝.insert arr[↑idx] = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
next acc =>
specialize ih acc rfl
rcases ih with ⟨hsize, ih⟩
simp only at ih
simp only [insert] at heq
split at heq
. exact False.elim heq
. split at heq
  . next h_dup =>
    exfalso simp only [List.contains] at h_dup
    rcases List.get_of_mem $ List.mem_of_elem_eq_true h_dup with ⟨j, hj⟩
    specialize ih j
    rw [hj] at ih
    have idx_add_one_add_j_in_bounds : idx.1 + 1 + j.1 < arr.size := by
      omega
    have idx_ne_idx_add_one_add_j_in_bounds : idx.1 ≠ idx.1 + 1 + j.1 := by
      omega
    exact arrNodup idx ⟨idx.1 + 1 + j.1, idx_add_one_add_j_in_bounds⟩ idx_ne_idx_add_one_add_j_in_bounds ih
  . simp only [Option.some.injEq] at heq
    have hsize' : c'.clause.length = arr.size - idx.1 := by
      simp only [← heq, List.length_cons, hsize]
      rw [Nat.succ_eq_add_one, Nat.sub_add_eq, Nat.sub_add_cancel]
      apply Nat.le_sub_of_add_le
      rw [Nat.add_comm]
      exact idx_add_one_le_arr_size
    apply Exists.intro hsize'
    intro i
    simp only
    have lhs_rw : c'.clause = arr[idx.1] :: acc.clause := by rw [← heq]
    simp only [List.get_of_eq lhs_rw]
    by_cases i.1 = 0
    . next i_eq_zero =>
      simp only [List.length_cons, i_eq_zero, List.get, Nat.add_zero]
    . next i_ne_zero =>
      rcases Nat.exists_eq_succ_of_ne_zero i_ne_zero with ⟨j, hj⟩
      simp only [List.length_cons, hj, List.get, Nat.succ_eq_add_one]
      simp only [Nat.add_comm j 1, ← Nat.add_assoc]
      exact ih ⟨j, by omega⟩
State after:
no goals

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
ih :
  ∀ (c' : DefaultClause n),
    some acc = some c' →
      ∃ hsize,
        ∀ (i : Fin c'.clause.length),
          let_fun idx_in_bounds := ⋯;
          c'.clause.get i = arr[↑idx + 1 + ↑i]
heq : acc.insert arr[↑idx] = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
specialize ih acc rfl
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
heq : acc.insert arr[↑idx] = some c'
ih :
  ∃ hsize,
    ∀ (i : Fin acc.clause.length),
      let_fun idx_in_bounds := ⋯;
      acc.clause.get i = arr[↑idx + 1 + ↑i]
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
heq : acc.insert arr[↑idx] = some c'
ih :
  ∃ hsize,
    ∀ (i : Fin acc.clause.length),
      let_fun idx_in_bounds := ⋯;
      acc.clause.get i = arr[↑idx + 1 + ↑i]
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
rcases ih with ⟨hsize, ih⟩
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
heq : acc.insert arr[↑idx] = some c'
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih :
  ∀ (i : Fin acc.clause.length),
    let_fun idx_in_bounds := ⋯;
    acc.clause.get i = arr[↑idx + 1 + ↑i]
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
heq : acc.insert arr[↑idx] = some c'
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih :
  ∀ (i : Fin acc.clause.length),
    let_fun idx_in_bounds := ⋯;
    acc.clause.get i = arr[↑idx + 1 + ↑i]
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
simp only at ih
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
heq : acc.insert arr[↑idx] = some c'
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
heq : acc.insert arr[↑idx] = some c'
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
simp only [insert] at heq
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
heq :
  (if h : acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true then none
    else
      if h : acc.clause.contains arr[↑idx] = true then some acc
      else some { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ }) =
    some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
heq :
  (if h : acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true then none
    else
      if h : acc.clause.contains arr[↑idx] = true then some acc
      else some { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ }) =
    some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
split at heq
State after:
case intro.isTrue
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝ : acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
heq : False
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

case intro.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
heq :
  (if h : acc.clause.contains arr[↑idx] = true then some acc
    else some { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ }) =
    some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro.isTrue
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝ : acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
heq : False
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

case intro.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
heq :
  (if h : acc.clause.contains arr[↑idx] = true then some acc
    else some { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ }) =
    some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
. exact False.elim heq
State after:
case intro.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
heq :
  (if h : acc.clause.contains arr[↑idx] = true then some acc
    else some { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ }) =
    some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
heq :
  (if h : acc.clause.contains arr[↑idx] = true then some acc
    else some { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ }) =
    some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
. split at heq
  . next h_dup =>
    exfalso simp only [List.contains] at h_dup
    rcases List.get_of_mem $ List.mem_of_elem_eq_true h_dup with ⟨j, hj⟩
    specialize ih j
    rw [hj] at ih
    have idx_add_one_add_j_in_bounds : idx.1 + 1 + j.1 < arr.size := by
      omega
    have idx_ne_idx_add_one_add_j_in_bounds : idx.1 ≠ idx.1 + 1 + j.1 := by
      omega
    exact arrNodup idx ⟨idx.1 + 1 + j.1, idx_add_one_add_j_in_bounds⟩ idx_ne_idx_add_one_add_j_in_bounds ih
  . simp only [Option.some.injEq] at heq
    have hsize' : c'.clause.length = arr.size - idx.1 := by
      simp only [← heq, List.length_cons, hsize]
      rw [Nat.succ_eq_add_one, Nat.sub_add_eq, Nat.sub_add_cancel]
      apply Nat.le_sub_of_add_le
      rw [Nat.add_comm]
      exact idx_add_one_le_arr_size
    apply Exists.intro hsize'
    intro i
    simp only
    have lhs_rw : c'.clause = arr[idx.1] :: acc.clause := by rw [← heq]
    simp only [List.get_of_eq lhs_rw]
    by_cases i.1 = 0
    . next i_eq_zero =>
      simp only [List.length_cons, i_eq_zero, List.get, Nat.add_zero]
    . next i_ne_zero =>
      rcases Nat.exists_eq_succ_of_ne_zero i_ne_zero with ⟨j, hj⟩
      simp only [List.length_cons, hj, List.get, Nat.succ_eq_add_one]
      simp only [Nat.add_comm j 1, ← Nat.add_assoc]
      exact ih ⟨j, by omega⟩
State after:
no goals

State before:
case intro.isTrue
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝ : acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
heq : False
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
exact False.elim heq
State after:
no goals

State before:
case intro.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
heq :
  (if h : acc.clause.contains arr[↑idx] = true then some acc
    else some { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ }) =
    some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
split at heq
State after:
case intro.isFalse.isTrue
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : acc.clause.contains arr[↑idx] = true
heq : some acc = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : some { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro.isFalse.isTrue
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : acc.clause.contains arr[↑idx] = true
heq : some acc = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : some { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
. next h_dup =>
  exfalso simp only [List.contains] at h_dup
  rcases List.get_of_mem $ List.mem_of_elem_eq_true h_dup with ⟨j, hj⟩
  specialize ih j
  rw [hj] at ih
  have idx_add_one_add_j_in_bounds : idx.1 + 1 + j.1 < arr.size := by
    omega
  have idx_ne_idx_add_one_add_j_in_bounds : idx.1 ≠ idx.1 + 1 + j.1 := by
    omega
  exact arrNodup idx ⟨idx.1 + 1 + j.1, idx_add_one_add_j_in_bounds⟩ idx_ne_idx_add_one_add_j_in_bounds ih
State after:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : some { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : some { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
. simp only [Option.some.injEq] at heq
  have hsize' : c'.clause.length = arr.size - idx.1 := by
    simp only [← heq, List.length_cons, hsize]
    rw [Nat.succ_eq_add_one, Nat.sub_add_eq, Nat.sub_add_cancel]
    apply Nat.le_sub_of_add_le
    rw [Nat.add_comm]
    exact idx_add_one_le_arr_size
  apply Exists.intro hsize'
  intro i
  simp only
  have lhs_rw : c'.clause = arr[idx.1] :: acc.clause := by rw [← heq]
  simp only [List.get_of_eq lhs_rw]
  by_cases i.1 = 0
  . next i_eq_zero =>
    simp only [List.length_cons, i_eq_zero, List.get, Nat.add_zero]
  . next i_ne_zero =>
    rcases Nat.exists_eq_succ_of_ne_zero i_ne_zero with ⟨j, hj⟩
    simp only [List.length_cons, hj, List.get, Nat.succ_eq_add_one]
    simp only [Nat.add_comm j 1, ← Nat.add_assoc]
    exact ih ⟨j, by omega⟩
State after:
no goals

State before:
case intro.isFalse.isTrue
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : acc.clause.contains arr[↑idx] = true
heq : some acc = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
next h_dup =>
exfalso simp only [List.contains] at h_dup
rcases List.get_of_mem $ List.mem_of_elem_eq_true h_dup with ⟨j, hj⟩
specialize ih j
rw [hj] at ih
have idx_add_one_add_j_in_bounds : idx.1 + 1 + j.1 < arr.size := by
  omega
have idx_ne_idx_add_one_add_j_in_bounds : idx.1 ≠ idx.1 + 1 + j.1 := by
  omega
exact arrNodup idx ⟨idx.1 + 1 + j.1, idx_add_one_add_j_in_bounds⟩ idx_ne_idx_add_one_add_j_in_bounds ih
State after:
no goals

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : acc.clause.contains arr[↑idx] = true
heq : some acc = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
exfalso
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : acc.clause.contains arr[↑idx] = true
heq : some acc = some c'
⊢ False

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : acc.clause.contains arr[↑idx] = true
heq : some acc = some c'
⊢ False
Tactic:
simp only [List.contains] at h_dup
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : List.elem arr[↑idx] acc.clause = true
heq : some acc = some c'
⊢ False

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : List.elem arr[↑idx] acc.clause = true
heq : some acc = some c'
⊢ False
Tactic:
rcases List.get_of_mem $ List.mem_of_elem_eq_true h_dup with ⟨j, hj⟩
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : List.elem arr[↑idx] acc.clause = true
heq : some acc = some c'
j : Fin acc.clause.length
hj : acc.clause.get j = arr[↑idx]
⊢ False

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : List.elem arr[↑idx] acc.clause = true
heq : some acc = some c'
j : Fin acc.clause.length
hj : acc.clause.get j = arr[↑idx]
⊢ False
Tactic:
specialize ih j
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : List.elem arr[↑idx] acc.clause = true
heq : some acc = some c'
j : Fin acc.clause.length
hj : acc.clause.get j = arr[↑idx]
ih : acc.clause.get j = arr[↑idx + 1 + ↑j]
⊢ False

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : List.elem arr[↑idx] acc.clause = true
heq : some acc = some c'
j : Fin acc.clause.length
hj : acc.clause.get j = arr[↑idx]
ih : acc.clause.get j = arr[↑idx + 1 + ↑j]
⊢ False
Tactic:
rw [hj] at ih
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : List.elem arr[↑idx] acc.clause = true
heq : some acc = some c'
j : Fin acc.clause.length
hj : acc.clause.get j = arr[↑idx]
ih : arr[↑idx] = arr[↑idx + 1 + ↑j]
⊢ False

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : List.elem arr[↑idx] acc.clause = true
heq : some acc = some c'
j : Fin acc.clause.length
hj : acc.clause.get j = arr[↑idx]
ih : arr[↑idx] = arr[↑idx + 1 + ↑j]
⊢ False
Tactic:
have idx_add_one_add_j_in_bounds : idx.1 + 1 + j.1 < arr.size := by
  omega
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : List.elem arr[↑idx] acc.clause = true
heq : some acc = some c'
j : Fin acc.clause.length
hj : acc.clause.get j = arr[↑idx]
ih : arr[↑idx] = arr[↑idx + 1 + ↑j]
idx_add_one_add_j_in_bounds : ↑idx + 1 + ↑j < arr.size
⊢ False

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : List.elem arr[↑idx] acc.clause = true
heq : some acc = some c'
j : Fin acc.clause.length
hj : acc.clause.get j = arr[↑idx]
ih : arr[↑idx] = arr[↑idx + 1 + ↑j]
idx_add_one_add_j_in_bounds : ↑idx + 1 + ↑j < arr.size
⊢ False
Tactic:
have idx_ne_idx_add_one_add_j_in_bounds : idx.1 ≠ idx.1 + 1 + j.1 := by
  omega
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : List.elem arr[↑idx] acc.clause = true
heq : some acc = some c'
j : Fin acc.clause.length
hj : acc.clause.get j = arr[↑idx]
ih : arr[↑idx] = arr[↑idx + 1 + ↑j]
idx_add_one_add_j_in_bounds : ↑idx + 1 + ↑j < arr.size
idx_ne_idx_add_one_add_j_in_bounds : ↑idx ≠ ↑idx + 1 + ↑j
⊢ False

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : List.elem arr[↑idx] acc.clause = true
heq : some acc = some c'
j : Fin acc.clause.length
hj : acc.clause.get j = arr[↑idx]
ih : arr[↑idx] = arr[↑idx + 1 + ↑j]
idx_add_one_add_j_in_bounds : ↑idx + 1 + ↑j < arr.size
idx_ne_idx_add_one_add_j_in_bounds : ↑idx ≠ ↑idx + 1 + ↑j
⊢ False
Tactic:
exact arrNodup idx ⟨idx.1 + 1 + j.1, idx_add_one_add_j_in_bounds⟩ idx_ne_idx_add_one_add_j_in_bounds ih
State after:
no goals

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : List.elem arr[↑idx] acc.clause = true
heq : some acc = some c'
j : Fin acc.clause.length
hj : acc.clause.get j = arr[↑idx]
ih : arr[↑idx] = arr[↑idx + 1 + ↑j]
⊢ ↑idx + 1 + ↑j < arr.size
Tactic:
omega
State after:
no goals

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
h✝ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h_dup : List.elem arr[↑idx] acc.clause = true
heq : some acc = some c'
j : Fin acc.clause.length
hj : acc.clause.get j = arr[↑idx]
ih : arr[↑idx] = arr[↑idx + 1 + ↑j]
idx_add_one_add_j_in_bounds : ↑idx + 1 + ↑j < arr.size
⊢ ↑idx ≠ ↑idx + 1 + ↑j
Tactic:
omega
State after:
no goals

State before:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : some { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = some c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
simp only [Option.some.injEq] at heq
State after:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
have hsize' : c'.clause.length = arr.size - idx.1 := by
  simp only [← heq, List.length_cons, hsize]
  rw [Nat.succ_eq_add_one, Nat.sub_add_eq, Nat.sub_add_cancel]
  apply Nat.le_sub_of_add_le
  rw [Nat.add_comm]
  exact idx_add_one_le_arr_size
State after:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
⊢ ∃ hsize,
    ∀ (i : Fin c'.clause.length),
      let_fun idx_in_bounds := ⋯;
      c'.clause.get i = arr[↑idx + ↑i]
Tactic:
apply Exists.intro hsize'
State after:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
⊢ ∀ (i : Fin c'.clause.length),
    let_fun idx_in_bounds := ⋯;
    c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
⊢ ∀ (i : Fin c'.clause.length),
    let_fun idx_in_bounds := ⋯;
    c'.clause.get i = arr[↑idx + ↑i]
Tactic:
intro i
State after:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
⊢ let_fun idx_in_bounds := ⋯;
  c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
⊢ let_fun idx_in_bounds := ⋯;
  c'.clause.get i = arr[↑idx + ↑i]
Tactic:
simp only
State after:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
⊢ c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
⊢ c'.clause.get i = arr[↑idx + ↑i]
Tactic:
have lhs_rw : c'.clause = arr[idx.1] :: acc.clause := by rw [← heq]
State after:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
⊢ c'.clause.get i = arr[↑idx + ↑i]

State before:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
⊢ c'.clause.get i = arr[↑idx + ↑i]
Tactic:
simp only [List.get_of_eq lhs_rw]
State after:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
⊢ (arr[↑idx] :: acc.clause).get ⟨↑i, ⋯⟩ = arr[↑idx + ↑i]

State before:
case intro.isFalse.isFalse
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
⊢ (arr[↑idx] :: acc.clause).get ⟨↑i, ⋯⟩ = arr[↑idx + ↑i]
Tactic:
by_cases i.1 = 0
State after:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝² : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝¹ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
h✝ : ↑i = 0
⊢ (arr[↑idx] :: acc.clause).get ⟨↑i, ⋯⟩ = arr[↑idx + ↑i]

case neg
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝² : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝¹ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
h✝ : ¬↑i = 0
⊢ (arr[↑idx] :: acc.clause).get ⟨↑i, ⋯⟩ = arr[↑idx + ↑i]

State before:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝² : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝¹ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
h✝ : ↑i = 0
⊢ (arr[↑idx] :: acc.clause).get ⟨↑i, ⋯⟩ = arr[↑idx + ↑i]

case neg
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝² : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝¹ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
h✝ : ¬↑i = 0
⊢ (arr[↑idx] :: acc.clause).get ⟨↑i, ⋯⟩ = arr[↑idx + ↑i]
Tactic:
. next i_eq_zero =>
  simp only [List.length_cons, i_eq_zero, List.get, Nat.add_zero]
State after:
case neg
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝² : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝¹ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
h✝ : ¬↑i = 0
⊢ (arr[↑idx] :: acc.clause).get ⟨↑i, ⋯⟩ = arr[↑idx + ↑i]

State before:
case neg
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝² : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝¹ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
h✝ : ¬↑i = 0
⊢ (arr[↑idx] :: acc.clause).get ⟨↑i, ⋯⟩ = arr[↑idx + ↑i]
Tactic:
. next i_ne_zero =>
  rcases Nat.exists_eq_succ_of_ne_zero i_ne_zero with ⟨j, hj⟩
  simp only [List.length_cons, hj, List.get, Nat.succ_eq_add_one]
  simp only [Nat.add_comm j 1, ← Nat.add_assoc]
  exact ih ⟨j, by omega⟩
State after:
no goals

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
⊢ c'.clause.length = arr.size - ↑idx
Tactic:
simp only [← heq, List.length_cons, hsize]
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
⊢ (arr.size - (↑idx + 1)).succ = arr.size - ↑idx

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
⊢ (arr.size - (↑idx + 1)).succ = arr.size - ↑idx
Tactic:
rw [Nat.succ_eq_add_one, Nat.sub_add_eq, Nat.sub_add_cancel]
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
⊢ 1 ≤ arr.size - ↑idx

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
⊢ 1 ≤ arr.size - ↑idx
Tactic:
apply Nat.le_sub_of_add_le
State after:
case h
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
⊢ 1 + ↑idx ≤ arr.size

State before:
case h
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
⊢ 1 + ↑idx ≤ arr.size
Tactic:
rw [Nat.add_comm]
State after:
case h
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
⊢ ↑idx + 1 ≤ arr.size

State before:
case h
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
⊢ ↑idx + 1 ≤ arr.size
Tactic:
exact idx_add_one_le_arr_size
State after:
no goals

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
⊢ c'.clause = arr[↑idx] :: acc.clause
Tactic:
rw [← heq]
State after:
no goals

State before:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝² : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝¹ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
h✝ : ↑i = 0
⊢ (arr[↑idx] :: acc.clause).get ⟨↑i, ⋯⟩ = arr[↑idx + ↑i]
Tactic:
next i_eq_zero =>
simp only [List.length_cons, i_eq_zero, List.get, Nat.add_zero]
State after:
no goals

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
i_eq_zero : ↑i = 0
⊢ (arr[↑idx] :: acc.clause).get ⟨↑i, ⋯⟩ = arr[↑idx + ↑i]
Tactic:
simp only [List.length_cons, i_eq_zero, List.get, Nat.add_zero]
State after:
no goals

State before:
case neg
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝² : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝¹ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
h✝ : ¬↑i = 0
⊢ (arr[↑idx] :: acc.clause).get ⟨↑i, ⋯⟩ = arr[↑idx + ↑i]
Tactic:
next i_ne_zero =>
rcases Nat.exists_eq_succ_of_ne_zero i_ne_zero with ⟨j, hj⟩
simp only [List.length_cons, hj, List.get, Nat.succ_eq_add_one]
simp only [Nat.add_comm j 1, ← Nat.add_assoc]
exact ih ⟨j, by omega⟩
State after:
no goals

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
i_ne_zero : ¬↑i = 0
⊢ (arr[↑idx] :: acc.clause).get ⟨↑i, ⋯⟩ = arr[↑idx + ↑i]
Tactic:
rcases Nat.exists_eq_succ_of_ne_zero i_ne_zero with ⟨j, hj⟩
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
i_ne_zero : ¬↑i = 0
j : Nat
hj : ↑i = j.succ
⊢ (arr[↑idx] :: acc.clause).get ⟨↑i, ⋯⟩ = arr[↑idx + ↑i]

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
i_ne_zero : ¬↑i = 0
j : Nat
hj : ↑i = j.succ
⊢ (arr[↑idx] :: acc.clause).get ⟨↑i, ⋯⟩ = arr[↑idx + ↑i]
Tactic:
simp only [List.length_cons, hj, List.get, Nat.succ_eq_add_one]
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
i_ne_zero : ¬↑i = 0
j : Nat
hj : ↑i = j.succ
⊢ acc.clause.get ⟨j, ⋯⟩ = arr[↑idx + (j + 1)]

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
i_ne_zero : ¬↑i = 0
j : Nat
hj : ↑i = j.succ
⊢ acc.clause.get ⟨j, ⋯⟩ = arr[↑idx + (j + 1)]
Tactic:
simp only [Nat.add_comm j 1, ← Nat.add_assoc]
State after:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
i_ne_zero : ¬↑i = 0
j : Nat
hj : ↑i = j.succ
⊢ acc.clause.get ⟨j, ⋯⟩ = arr[↑idx + 1 + j]

State before:
case intro
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
i_ne_zero : ¬↑i = 0
j : Nat
hj : ↑i = j.succ
⊢ acc.clause.get ⟨j, ⋯⟩ = arr[↑idx + 1 + j]
Tactic:
exact ih ⟨j, by omega⟩
State after:
no goals

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
idx : Fin arr.size
idx_add_one_le_arr_size : ↑idx + 1 ≤ arr.size
c' : DefaultClause n
acc✝ : Option (DefaultClause n)
acc : DefaultClause n
hsize : acc.clause.length = arr.size - (↑idx + 1)
ih : ∀ (i : Fin acc.clause.length), acc.clause.get i = arr[↑idx + 1 + ↑i]
h✝¹ : ¬acc.clause.contains (arr[↑idx].fst, !arr[↑idx].snd) = true
h✝ : ¬acc.clause.contains arr[↑idx] = true
heq : { clause := arr[↑idx] :: acc.clause, nodupkey := ⋯, nodup := ⋯ } = c'
hsize' : c'.clause.length = arr.size - ↑idx
i : Fin c'.clause.length
lhs_rw : c'.clause = arr[↑idx] :: acc.clause
i_ne_zero : ¬↑i = 0
j : Nat
hj : ↑i = j.succ
⊢ j < acc.clause.length
Tactic:
omega
State after:
no goals

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
h :
  ∀ (i : Fin c.clause.length),
    let_fun idx_in_bounds := ⋯;
    c.clause.get i = arr[0 + ↑i]
i : Nat
l : Literal (PosFin n)
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i
Tactic:
by_cases i_in_bounds : i < c.clause.length
State after:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
h :
  ∀ (i : Fin c.clause.length),
    let_fun idx_in_bounds := ⋯;
    c.clause.get i = arr[0 + ↑i]
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < c.clause.length
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i

case neg
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
h :
  ∀ (i : Fin c.clause.length),
    let_fun idx_in_bounds := ⋯;
    c.clause.get i = arr[0 + ↑i]
i : Nat
l : Literal (PosFin n)
i_in_bounds : ¬i < c.clause.length
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i

State before:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
h :
  ∀ (i : Fin c.clause.length),
    let_fun idx_in_bounds := ⋯;
    c.clause.get i = arr[0 + ↑i]
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < c.clause.length
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i

case neg
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
h :
  ∀ (i : Fin c.clause.length),
    let_fun idx_in_bounds := ⋯;
    c.clause.get i = arr[0 + ↑i]
i : Nat
l : Literal (PosFin n)
i_in_bounds : ¬i < c.clause.length
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i
Tactic:
. specialize h ⟨i, i_in_bounds⟩
  simp only at h
  have i_in_bounds' : i < arr.data.length := by
    dsimp; omega
  rw [List.get?_eq_get i_in_bounds, List.get?_eq_get i_in_bounds']
  simp only [h, Nat.zero_add, Array.getElem_eq_data_get, Option.mem_def, Option.some.injEq]
State after:
case neg
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
h :
  ∀ (i : Fin c.clause.length),
    let_fun idx_in_bounds := ⋯;
    c.clause.get i = arr[0 + ↑i]
i : Nat
l : Literal (PosFin n)
i_in_bounds : ¬i < c.clause.length
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i

State before:
case neg
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
h :
  ∀ (i : Fin c.clause.length),
    let_fun idx_in_bounds := ⋯;
    c.clause.get i = arr[0 + ↑i]
i : Nat
l : Literal (PosFin n)
i_in_bounds : ¬i < c.clause.length
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i
Tactic:
. have arr_data_length_le_i : arr.data.length ≤ i := by
    dsimp; omega
  simp only [Nat.not_lt, ← List.get?_eq_none] at i_in_bounds arr_data_length_le_i
  rw [i_in_bounds, arr_data_length_le_i]
State after:
no goals

State before:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
h :
  ∀ (i : Fin c.clause.length),
    let_fun idx_in_bounds := ⋯;
    c.clause.get i = arr[0 + ↑i]
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < c.clause.length
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i
Tactic:
specialize h ⟨i, i_in_bounds⟩
State after:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < c.clause.length
h :
  let_fun idx_in_bounds := ⋯;
  c.clause.get ⟨i, i_in_bounds⟩ = arr[0 + ↑⟨i, i_in_bounds⟩]
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i

State before:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < c.clause.length
h :
  let_fun idx_in_bounds := ⋯;
  c.clause.get ⟨i, i_in_bounds⟩ = arr[0 + ↑⟨i, i_in_bounds⟩]
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i
Tactic:
simp only at h
State after:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < c.clause.length
h : c.clause.get ⟨i, i_in_bounds⟩ = arr[0 + i]
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i

State before:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < c.clause.length
h : c.clause.get ⟨i, i_in_bounds⟩ = arr[0 + i]
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i
Tactic:
have i_in_bounds' : i < arr.data.length := by
  dsimp; omega
State after:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < c.clause.length
h : c.clause.get ⟨i, i_in_bounds⟩ = arr[0 + i]
i_in_bounds' : i < arr.data.length
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i

State before:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < c.clause.length
h : c.clause.get ⟨i, i_in_bounds⟩ = arr[0 + i]
i_in_bounds' : i < arr.data.length
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i
Tactic:
rw [List.get?_eq_get i_in_bounds, List.get?_eq_get i_in_bounds']
State after:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < c.clause.length
h : c.clause.get ⟨i, i_in_bounds⟩ = arr[0 + i]
i_in_bounds' : i < arr.data.length
⊢ l ∈ some (c.clause.get ⟨i, i_in_bounds⟩) ↔ l ∈ some (arr.data.get ⟨i, i_in_bounds'⟩)

State before:
case pos
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < c.clause.length
h : c.clause.get ⟨i, i_in_bounds⟩ = arr[0 + i]
i_in_bounds' : i < arr.data.length
⊢ l ∈ some (c.clause.get ⟨i, i_in_bounds⟩) ↔ l ∈ some (arr.data.get ⟨i, i_in_bounds'⟩)
Tactic:
simp only [h, Nat.zero_add, Array.getElem_eq_data_get, Option.mem_def, Option.some.injEq]
State after:
no goals

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < c.clause.length
h : c.clause.get ⟨i, i_in_bounds⟩ = arr[0 + i]
⊢ i < arr.data.length
Tactic:
dsimp
State after:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < c.clause.length
h : c.clause.get ⟨i, i_in_bounds⟩ = arr[0 + i]
⊢ i < arr.size

State before:
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
i : Nat
l : Literal (PosFin n)
i_in_bounds : i < c.clause.length
h : c.clause.get ⟨i, i_in_bounds⟩ = arr[0 + i]
⊢ i < arr.size
Tactic:
omega
State after:
no goals

State before:
case neg
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
h :
  ∀ (i : Fin c.clause.length),
    let_fun idx_in_bounds := ⋯;
    c.clause.get i = arr[0 + ↑i]
i : Nat
l : Literal (PosFin n)
i_in_bounds : ¬i < c.clause.length
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i
Tactic:
have arr_data_length_le_i : arr.data.length ≤ i := by
  dsimp; omega
State after:
case neg
n : Nat
arr : Array (Literal (PosFin n))
arrNodup : ∀ (i j : Fin arr.size), ↑i ≠ ↑j → arr[i] ≠ arr[j]
c : DefaultClause n
h✝ :
  Array.foldr
      (fun l acc =>
        match acc with
        | none => none
        | some acc => acc.insert l)
      (some empty) arr arr.size =
    some c
motive : Nat → Option (DefaultClause n) → Prop :=
  fun idx acc =>
    ∃ idx_le_arr_size,
      ∀ (c' : DefaultClause n),
        acc = some c' →
          ∃ hsize,
            ∀ (i : Fin c'.clause.length),
              let_fun idx_in_bounds := ⋯;
              c'.clause.get i = arr[idx + ↑i]
h_base : motive arr.size (some empty)
fold_fn : Literal (PosFin n) → Option (DefaultClause n) → Option (DefaultClause n) :=
  fun l acc =>
    match acc with
    | none => none
    | some acc => acc.insert l
h_inductive :
  ∀ (idx : Fin arr.size) (acc : Option (DefaultClause n)), motive (↑idx + 1) acc → motive (↑idx) (fold_fn arr[idx] acc)
hsize : c.clause.length = arr.size - 0
h :
  ∀ (i : Fin c.clause.length),
    let_fun idx_in_bounds := ⋯;
    c.clause.get i = arr[0 + ↑i]
i : Nat
l : Literal (PosFin n)
i_in_bounds : ¬i < c.clause.length
arr_data_length_le_i : arr.data.length ≤ i
⊢ l ∈ c.clause.get? i ↔ l ∈ arr.data.get? i