l3lab/ntp-mathlib huggingface dataset:
set_option linter.deprecated false in
theorem prev_nthLe (l : List α) (h : Nodup l) (n : ℕ) (hn : n < l.length) :
    prev l (l.nthLe n hn) (nthLe_mem _ _ _) =
      l.nthLe ((n + (l.length - 1)) % l.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' l with x l
  · simp at hn
  induction' l with y l hl generalizing n x
  · simp
  · rcases n with (_ | _ | n)
    · simp [Nat.add_succ_sub_one, add_zero, List.prev_cons_cons_eq, Nat.zero_eq, List.length,
        List.nthLe, Nat.succ_add_sub_one, zero_add, getLast_eq_get,
        Nat.mod_eq_of_lt (Nat.succ_lt_succ l.length.lt_succ_self)]
    · simp only [mem_cons, nodup_cons] at h
      push_neg at h
      simp only [List.prev_cons_cons_of_ne _ _ _ _ h.left.left.symm, Nat.zero_eq, List.length,
        List.nthLe, add_comm, eq_self_iff_true, Nat.succ_add_sub_one, Nat.mod_self, zero_add,
        List.get]
    · rw [prev_ne_cons_cons]
      · convert hl n.succ y h.of_cons (Nat.le_of_succ_le_succ hn) using 1
        have : ∀ k hk, (y :: l).nthLe k hk = (x :: y :: l).nthLe (k + 1) (Nat.succ_lt_succ hk) := by
          intros
          simp [List.nthLe]
        rw [this]
        congr
        simp only [Nat.add_succ_sub_one, add_zero, length]
        

Proof state:
case h.e'_3.e_n
α : Type u_1
inst✝ : DecidableEq α
l✝ : List α
x✝ y : α
l : List α
hl :
  ∀ (n : ℕ) (x : α),
    Nodup (x :: l) →
      ∀ (hn : n < length (x :: l)),
        prev (x :: l) (nthLe (x :: l) n hn) (_ : nthLe (x :: l) n hn ∈ x :: l) =
          nthLe (x :: l) ((n + (length (x :: l) - 1)) % length (x :: l))
            (_ : (n + (length (x :: l) - 1)) % length (x :: l) < length (x :: l))
x : α
h : Nodup (x :: y :: l)
n : ℕ
hn : Nat.succ (Nat.succ n) < length (x :: y :: l)
this :
  ∀ (k : ℕ) (hk : k < length (y :: l)),
    nthLe (y :: l) k hk = nthLe (x :: y :: l) (k + 1) (_ : Nat.succ k < Nat.succ (length (y :: l)))
⊢ (Nat.succ (Nat.succ n) + (length l + 1)) % (length l + 1 + 1) = (Nat.succ n + length l) % (length l + 1) + 1

Next tactic:
simp only [length, Nat.succ_lt_succ_iff] at hn
set_option linter.deprecated false in
theorem prev_nthLe (l : List α) (h : Nodup l) (n : ℕ) (hn : n < l.length) :
    prev l (l.nthLe n hn) (nthLe_mem _ _ _) =
      l.nthLe ((n + (l.length - 1)) % l.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' l with x l
  · simp at hn
  induction' l with y l hl generalizing n x
  · simp
  · rcases n with (_ | _ | n)
    · simp [Nat.add_succ_sub_one, add_zero, List.prev_cons_cons_eq, Nat.zero_eq, List.length,
        List.nthLe, Nat.succ_add_sub_one, zero_add, getLast_eq_get,
        Nat.mod_eq_of_lt (Nat.succ_lt_succ l.length.lt_succ_self)]
    · simp only [mem_cons, nodup_cons] at h
      push_neg at h
      simp only [List.prev_cons_cons_of_ne _ _ _ _ h.left.left.symm, Nat.zero_eq, List.length,
        List.nthLe, add_comm, eq_self_iff_true, Nat.succ_add_sub_one, Nat.mod_self, zero_add,
        List.get]
    · rw [prev_ne_cons_cons]
      · convert hl n.succ y h.of_cons (Nat.le_of_succ_le_succ hn) using 1
        have : ∀ k hk, (y :: l).nthLe k hk = (x :: y :: l).nthLe (k + 1) (Nat.succ_lt_succ hk) := by
          intros
          simp [List.nthLe]
        rw [this]
        congr
        simp only [Nat.add_succ_sub_one, add_zero, length]
        simp only [length, Nat.succ_lt_succ_iff] at hn
        

Proof state:
case h.e'_3.e_n
α : Type u_1
inst✝ : DecidableEq α
l✝ : List α
x✝ y : α
l : List α
hl :
  ∀ (n : ℕ) (x : α),
    Nodup (x :: l) →
      ∀ (hn : n < length (x :: l)),
        prev (x :: l) (nthLe (x :: l) n hn) (_ : nthLe (x :: l) n hn ∈ x :: l) =
          nthLe (x :: l) ((n + (length (x :: l) - 1)) % length (x :: l))
            (_ : (n + (length (x :: l) - 1)) % length (x :: l) < length (x :: l))
x : α
h : Nodup (x :: y :: l)
n : ℕ
this :
  ∀ (k : ℕ) (hk : k < length (y :: l)),
    nthLe (y :: l) k hk = nthLe (x :: y :: l) (k + 1) (_ : Nat.succ k < Nat.succ (length (y :: l)))
hn : n < length l
⊢ (Nat.succ (Nat.succ n) + (length l + 1)) % (length l + 1 + 1) = (Nat.succ n + length l) % (length l + 1) + 1

Next tactic:
set k := l.length
set_option linter.deprecated false in
theorem prev_nthLe (l : List α) (h : Nodup l) (n : ℕ) (hn : n < l.length) :
    prev l (l.nthLe n hn) (nthLe_mem _ _ _) =
      l.nthLe ((n + (l.length - 1)) % l.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' l with x l
  · simp at hn
  induction' l with y l hl generalizing n x
  · simp
  · rcases n with (_ | _ | n)
    · simp [Nat.add_succ_sub_one, add_zero, List.prev_cons_cons_eq, Nat.zero_eq, List.length,
        List.nthLe, Nat.succ_add_sub_one, zero_add, getLast_eq_get,
        Nat.mod_eq_of_lt (Nat.succ_lt_succ l.length.lt_succ_self)]
    · simp only [mem_cons, nodup_cons] at h
      push_neg at h
      simp only [List.prev_cons_cons_of_ne _ _ _ _ h.left.left.symm, Nat.zero_eq, List.length,
        List.nthLe, add_comm, eq_self_iff_true, Nat.succ_add_sub_one, Nat.mod_self, zero_add,
        List.get]
    · rw [prev_ne_cons_cons]
      · convert hl n.succ y h.of_cons (Nat.le_of_succ_le_succ hn) using 1
        have : ∀ k hk, (y :: l).nthLe k hk = (x :: y :: l).nthLe (k + 1) (Nat.succ_lt_succ hk) := by
          intros
          simp [List.nthLe]
        rw [this]
        congr
        simp only [Nat.add_succ_sub_one, add_zero, length]
        simp only [length, Nat.succ_lt_succ_iff] at hn
        set k := l.length
        

Proof state:
case h.e'_3.e_n
α : Type u_1
inst✝ : DecidableEq α
l✝ : List α
x✝ y : α
l : List α
hl :
  ∀ (n : ℕ) (x : α),
    Nodup (x :: l) →
      ∀ (hn : n < length (x :: l)),
        prev (x :: l) (nthLe (x :: l) n hn) (_ : nthLe (x :: l) n hn ∈ x :: l) =
          nthLe (x :: l) ((n + (length (x :: l) - 1)) % length (x :: l))
            (_ : (n + (length (x :: l) - 1)) % length (x :: l) < length (x :: l))
x : α
h : Nodup (x :: y :: l)
n : ℕ
this :
  ∀ (k : ℕ) (hk : k < length (y :: l)),
    nthLe (y :: l) k hk = nthLe (x :: y :: l) (k + 1) (_ : Nat.succ k < Nat.succ (length (y :: l)))
k : ℕ := length l
hn : n < k
⊢ (Nat.succ (Nat.succ n) + (k + 1)) % (k + 1 + 1) = (Nat.succ n + k) % (k + 1) + 1

Next tactic:
rw [Nat.succ_add, ← Nat.add_succ, Nat.add_mod_right, Nat.succ_add, ← Nat.add_succ _ k,
          Nat.add_mod_right, Nat.mod_eq_of_lt, Nat.mod_eq_of_lt]
set_option linter.deprecated false in
theorem prev_nthLe (l : List α) (h : Nodup l) (n : ℕ) (hn : n < l.length) :
    prev l (l.nthLe n hn) (nthLe_mem _ _ _) =
      l.nthLe ((n + (l.length - 1)) % l.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' l with x l
  · simp at hn
  induction' l with y l hl generalizing n x
  · simp
  · rcases n with (_ | _ | n)
    · simp [Nat.add_succ_sub_one, add_zero, List.prev_cons_cons_eq, Nat.zero_eq, List.length,
        List.nthLe, Nat.succ_add_sub_one, zero_add, getLast_eq_get,
        Nat.mod_eq_of_lt (Nat.succ_lt_succ l.length.lt_succ_self)]
    · simp only [mem_cons, nodup_cons] at h
      push_neg at h
      simp only [List.prev_cons_cons_of_ne _ _ _ _ h.left.left.symm, Nat.zero_eq, List.length,
        List.nthLe, add_comm, eq_self_iff_true, Nat.succ_add_sub_one, Nat.mod_self, zero_add,
        List.get]
    · rw [prev_ne_cons_cons]
      · convert hl n.succ y h.of_cons (Nat.le_of_succ_le_succ hn) using 1
        have : ∀ k hk, (y :: l).nthLe k hk = (x :: y :: l).nthLe (k + 1) (Nat.succ_lt_succ hk) := by
          intros
          simp [List.nthLe]
        rw [this]
        congr
        simp only [Nat.add_succ_sub_one, add_zero, length]
        simp only [length, Nat.succ_lt_succ_iff] at hn
        set k := l.length
        rw [Nat.succ_add, ← Nat.add_succ, Nat.add_mod_right, Nat.succ_add, ← Nat.add_succ _ k,
          Nat.add_mod_right, Nat.mod_eq_of_lt, Nat.mod_eq_of_lt]
        · 

Proof state:
case h.e'_3.e_n
α : Type u_1
inst✝ : DecidableEq α
l✝ : List α
x✝ y : α
l : List α
hl :
  ∀ (n : ℕ) (x : α),
    Nodup (x :: l) →
      ∀ (hn : n < length (x :: l)),
        prev (x :: l) (nthLe (x :: l) n hn) (_ : nthLe (x :: l) n hn ∈ x :: l) =
          nthLe (x :: l) ((n + (length (x :: l) - 1)) % length (x :: l))
            (_ : (n + (length (x :: l) - 1)) % length (x :: l) < length (x :: l))
x : α
h : Nodup (x :: y :: l)
n : ℕ
this :
  ∀ (k : ℕ) (hk : k < length (y :: l)),
    nthLe (y :: l) k hk = nthLe (x :: y :: l) (k + 1) (_ : Nat.succ k < Nat.succ (length (y :: l)))
k : ℕ := length l
hn : n < k
⊢ n < Nat.succ k

Next tactic:
exact Nat.lt_succ_of_lt hn
set_option linter.deprecated false in
theorem prev_nthLe (l : List α) (h : Nodup l) (n : ℕ) (hn : n < l.length) :
    prev l (l.nthLe n hn) (nthLe_mem _ _ _) =
      l.nthLe ((n + (l.length - 1)) % l.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' l with x l
  · simp at hn
  induction' l with y l hl generalizing n x
  · simp
  · rcases n with (_ | _ | n)
    · simp [Nat.add_succ_sub_one, add_zero, List.prev_cons_cons_eq, Nat.zero_eq, List.length,
        List.nthLe, Nat.succ_add_sub_one, zero_add, getLast_eq_get,
        Nat.mod_eq_of_lt (Nat.succ_lt_succ l.length.lt_succ_self)]
    · simp only [mem_cons, nodup_cons] at h
      push_neg at h
      simp only [List.prev_cons_cons_of_ne _ _ _ _ h.left.left.symm, Nat.zero_eq, List.length,
        List.nthLe, add_comm, eq_self_iff_true, Nat.succ_add_sub_one, Nat.mod_self, zero_add,
        List.get]
    · rw [prev_ne_cons_cons]
      · convert hl n.succ y h.of_cons (Nat.le_of_succ_le_succ hn) using 1
        have : ∀ k hk, (y :: l).nthLe k hk = (x :: y :: l).nthLe (k + 1) (Nat.succ_lt_succ hk) := by
          intros
          simp [List.nthLe]
        rw [this]
        congr
        simp only [Nat.add_succ_sub_one, add_zero, length]
        simp only [length, Nat.succ_lt_succ_iff] at hn
        set k := l.length
        rw [Nat.succ_add, ← Nat.add_succ, Nat.add_mod_right, Nat.succ_add, ← Nat.add_succ _ k,
          Nat.add_mod_right, Nat.mod_eq_of_lt, Nat.mod_eq_of_lt]
        · exact Nat.lt_succ_of_lt hn
        · 

Proof state:
case h.e'_3.e_n
α : Type u_1
inst✝ : DecidableEq α
l✝ : List α
x✝ y : α
l : List α
hl :
  ∀ (n : ℕ) (x : α),
    Nodup (x :: l) →
      ∀ (hn : n < length (x :: l)),
        prev (x :: l) (nthLe (x :: l) n hn) (_ : nthLe (x :: l) n hn ∈ x :: l) =
          nthLe (x :: l) ((n + (length (x :: l) - 1)) % length (x :: l))
            (_ : (n + (length (x :: l) - 1)) % length (x :: l) < length (x :: l))
x : α
h : Nodup (x :: y :: l)
n : ℕ
this :
  ∀ (k : ℕ) (hk : k < length (y :: l)),
    nthLe (y :: l) k hk = nthLe (x :: y :: l) (k + 1) (_ : Nat.succ k < Nat.succ (length (y :: l)))
k : ℕ := length l
hn : n < k
⊢ n + 1 < Nat.succ (k + 1)

Next tactic:
exact Nat.succ_lt_succ (Nat.lt_succ_of_lt hn)
set_option linter.deprecated false in
theorem prev_nthLe (l : List α) (h : Nodup l) (n : ℕ) (hn : n < l.length) :
    prev l (l.nthLe n hn) (nthLe_mem _ _ _) =
      l.nthLe ((n + (l.length - 1)) % l.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' l with x l
  · simp at hn
  induction' l with y l hl generalizing n x
  · simp
  · rcases n with (_ | _ | n)
    · simp [Nat.add_succ_sub_one, add_zero, List.prev_cons_cons_eq, Nat.zero_eq, List.length,
        List.nthLe, Nat.succ_add_sub_one, zero_add, getLast_eq_get,
        Nat.mod_eq_of_lt (Nat.succ_lt_succ l.length.lt_succ_self)]
    · simp only [mem_cons, nodup_cons] at h
      push_neg at h
      simp only [List.prev_cons_cons_of_ne _ _ _ _ h.left.left.symm, Nat.zero_eq, List.length,
        List.nthLe, add_comm, eq_self_iff_true, Nat.succ_add_sub_one, Nat.mod_self, zero_add,
        List.get]
    · rw [prev_ne_cons_cons]
      · convert hl n.succ y h.of_cons (Nat.le_of_succ_le_succ hn) using 1
        have : ∀ k hk, (y :: l).nthLe k hk = (x :: y :: l).nthLe (k + 1) (Nat.succ_lt_succ hk) := by
          intros
          simp [List.nthLe]
        rw [this]
        congr
        simp only [Nat.add_succ_sub_one, add_zero, length]
        simp only [length, Nat.succ_lt_succ_iff] at hn
        set k := l.length
        rw [Nat.succ_add, ← Nat.add_succ, Nat.add_mod_right, Nat.succ_add, ← Nat.add_succ _ k,
          Nat.add_mod_right, Nat.mod_eq_of_lt, Nat.mod_eq_of_lt]
        · exact Nat.lt_succ_of_lt hn
        · exact Nat.succ_lt_succ (Nat.lt_succ_of_lt hn)
      · 

Proof state:
case cons.cons.succ.succ.hy
α : Type u_1
inst✝ : DecidableEq α
l✝ : List α
x✝ y : α
l : List α
hl :
  ∀ (n : ℕ) (x : α),
    Nodup (x :: l) →
      ∀ (hn : n < length (x :: l)),
        prev (x :: l) (nthLe (x :: l) n hn) (_ : nthLe (x :: l) n hn ∈ x :: l) =
          nthLe (x :: l) ((n + (length (x :: l) - 1)) % length (x :: l))
            (_ : (n + (length (x :: l) - 1)) % length (x :: l) < length (x :: l))
x : α
h : Nodup (x :: y :: l)
n : ℕ
hn : Nat.succ (Nat.succ n) < length (x :: y :: l)
⊢ nthLe (x :: y :: l) (Nat.succ (Nat.succ n)) hn ≠ x

Next tactic:
intro H
set_option linter.deprecated false in
theorem prev_nthLe (l : List α) (h : Nodup l) (n : ℕ) (hn : n < l.length) :
    prev l (l.nthLe n hn) (nthLe_mem _ _ _) =
      l.nthLe ((n + (l.length - 1)) % l.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' l with x l
  · simp at hn
  induction' l with y l hl generalizing n x
  · simp
  · rcases n with (_ | _ | n)
    · simp [Nat.add_succ_sub_one, add_zero, List.prev_cons_cons_eq, Nat.zero_eq, List.length,
        List.nthLe, Nat.succ_add_sub_one, zero_add, getLast_eq_get,
        Nat.mod_eq_of_lt (Nat.succ_lt_succ l.length.lt_succ_self)]
    · simp only [mem_cons, nodup_cons] at h
      push_neg at h
      simp only [List.prev_cons_cons_of_ne _ _ _ _ h.left.left.symm, Nat.zero_eq, List.length,
        List.nthLe, add_comm, eq_self_iff_true, Nat.succ_add_sub_one, Nat.mod_self, zero_add,
        List.get]
    · rw [prev_ne_cons_cons]
      · convert hl n.succ y h.of_cons (Nat.le_of_succ_le_succ hn) using 1
        have : ∀ k hk, (y :: l).nthLe k hk = (x :: y :: l).nthLe (k + 1) (Nat.succ_lt_succ hk) := by
          intros
          simp [List.nthLe]
        rw [this]
        congr
        simp only [Nat.add_succ_sub_one, add_zero, length]
        simp only [length, Nat.succ_lt_succ_iff] at hn
        set k := l.length
        rw [Nat.succ_add, ← Nat.add_succ, Nat.add_mod_right, Nat.succ_add, ← Nat.add_succ _ k,
          Nat.add_mod_right, Nat.mod_eq_of_lt, Nat.mod_eq_of_lt]
        · exact Nat.lt_succ_of_lt hn
        · exact Nat.succ_lt_succ (Nat.lt_succ_of_lt hn)
      · intro H
        

Proof state:
case cons.cons.succ.succ.hy
α : Type u_1
inst✝ : DecidableEq α
l✝ : List α
x✝ y : α
l : List α
hl :
  ∀ (n : ℕ) (x : α),
    Nodup (x :: l) →
      ∀ (hn : n < length (x :: l)),
        prev (x :: l) (nthLe (x :: l) n hn) (_ : nthLe (x :: l) n hn ∈ x :: l) =
          nthLe (x :: l) ((n + (length (x :: l) - 1)) % length (x :: l))
            (_ : (n + (length (x :: l) - 1)) % length (x :: l) < length (x :: l))
x : α
h : Nodup (x :: y :: l)
n : ℕ
hn : Nat.succ (Nat.succ n) < length (x :: y :: l)
H : nthLe (x :: y :: l) (Nat.succ (Nat.succ n)) hn = x
⊢ False

Next tactic:
suffices n.succ.succ = 0 by simpa
set_option linter.deprecated false in
theorem prev_nthLe (l : List α) (h : Nodup l) (n : ℕ) (hn : n < l.length) :
    prev l (l.nthLe n hn) (nthLe_mem _ _ _) =
      l.nthLe ((n + (l.length - 1)) % l.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' l with x l
  · simp at hn
  induction' l with y l hl generalizing n x
  · simp
  · rcases n with (_ | _ | n)
    · simp [Nat.add_succ_sub_one, add_zero, List.prev_cons_cons_eq, Nat.zero_eq, List.length,
        List.nthLe, Nat.succ_add_sub_one, zero_add, getLast_eq_get,
        Nat.mod_eq_of_lt (Nat.succ_lt_succ l.length.lt_succ_self)]
    · simp only [mem_cons, nodup_cons] at h
      push_neg at h
      simp only [List.prev_cons_cons_of_ne _ _ _ _ h.left.left.symm, Nat.zero_eq, List.length,
        List.nthLe, add_comm, eq_self_iff_true, Nat.succ_add_sub_one, Nat.mod_self, zero_add,
        List.get]
    · rw [prev_ne_cons_cons]
      · convert hl n.succ y h.of_cons (Nat.le_of_succ_le_succ hn) using 1
        have : ∀ k hk, (y :: l).nthLe k hk = (x :: y :: l).nthLe (k + 1) (Nat.succ_lt_succ hk) := by
          intros
          simp [List.nthLe]
        rw [this]
        congr
        simp only [Nat.add_succ_sub_one, add_zero, length]
        simp only [length, Nat.succ_lt_succ_iff] at hn
        set k := l.length
        rw [Nat.succ_add, ← Nat.add_succ, Nat.add_mod_right, Nat.succ_add, ← Nat.add_succ _ k,
          Nat.add_mod_right, Nat.mod_eq_of_lt, Nat.mod_eq_of_lt]
        · exact Nat.lt_succ_of_lt hn
        · exact Nat.succ_lt_succ (Nat.lt_succ_of_lt hn)
      · intro H
        suffices n.succ.succ = 0 by 

Proof state:
α : Type u_1
inst✝ : DecidableEq α
l✝ : List α
x✝ y : α
l : List α
hl :
  ∀ (n : ℕ) (x : α),
    Nodup (x :: l) →
      ∀ (hn : n < length (x :: l)),
        prev (x :: l) (nthLe (x :: l) n hn) (_ : nthLe (x :: l) n hn ∈ x :: l) =
          nthLe (x :: l) ((n + (length (x :: l) - 1)) % length (x :: l))
            (_ : (n + (length (x :: l) - 1)) % length (x :: l) < length (x :: l))
x : α
h : Nodup (x :: y :: l)
n : ℕ
hn : Nat.succ (Nat.succ n) < length (x :: y :: l)
H : nthLe (x :: y :: l) (Nat.succ (Nat.succ n)) hn = x
this : Nat.succ (Nat.succ n) = 0
⊢ False

Next tactic:
simpa
set_option linter.deprecated false in
theorem prev_nthLe (l : List α) (h : Nodup l) (n : ℕ) (hn : n < l.length) :
    prev l (l.nthLe n hn) (nthLe_mem _ _ _) =
      l.nthLe ((n + (l.length - 1)) % l.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' l with x l
  · simp at hn
  induction' l with y l hl generalizing n x
  · simp
  · rcases n with (_ | _ | n)
    · simp [Nat.add_succ_sub_one, add_zero, List.prev_cons_cons_eq, Nat.zero_eq, List.length,
        List.nthLe, Nat.succ_add_sub_one, zero_add, getLast_eq_get,
        Nat.mod_eq_of_lt (Nat.succ_lt_succ l.length.lt_succ_self)]
    · simp only [mem_cons, nodup_cons] at h
      push_neg at h
      simp only [List.prev_cons_cons_of_ne _ _ _ _ h.left.left.symm, Nat.zero_eq, List.length,
        List.nthLe, add_comm, eq_self_iff_true, Nat.succ_add_sub_one, Nat.mod_self, zero_add,
        List.get]
    · rw [prev_ne_cons_cons]
      · convert hl n.succ y h.of_cons (Nat.le_of_succ_le_succ hn) using 1
        have : ∀ k hk, (y :: l).nthLe k hk = (x :: y :: l).nthLe (k + 1) (Nat.succ_lt_succ hk) := by
          intros
          simp [List.nthLe]
        rw [this]
        congr
        simp only [Nat.add_succ_sub_one, add_zero, length]
        simp only [length, Nat.succ_lt_succ_iff] at hn
        set k := l.length
        rw [Nat.succ_add, ← Nat.add_succ, Nat.add_mod_right, Nat.succ_add, ← Nat.add_succ _ k,
          Nat.add_mod_right, Nat.mod_eq_of_lt, Nat.mod_eq_of_lt]
        · exact Nat.lt_succ_of_lt hn
        · exact Nat.succ_lt_succ (Nat.lt_succ_of_lt hn)
      · intro H
        suffices n.succ.succ = 0 by simpa
        

Proof state:
case cons.cons.succ.succ.hy
α : Type u_1
inst✝ : DecidableEq α
l✝ : List α
x✝ y : α
l : List α
hl :
  ∀ (n : ℕ) (x : α),
    Nodup (x :: l) →
      ∀ (hn : n < length (x :: l)),
        prev (x :: l) (nthLe (x :: l) n hn) (_ : nthLe (x :: l) n hn ∈ x :: l) =
          nthLe (x :: l) ((n + (length (x :: l) - 1)) % length (x :: l))
            (_ : (n + (length (x :: l) - 1)) % length (x :: l) < length (x :: l))
x : α
h : Nodup (x :: y :: l)
n : ℕ
hn : Nat.succ (Nat.succ n) < length (x :: y :: l)
H : nthLe (x :: y :: l) (Nat.succ (Nat.succ n)) hn = x
⊢ Nat.succ (Nat.succ n) = 0

Next tactic:
rw [nodup_iff_nthLe_inj] at h
set_option linter.deprecated false in
theorem prev_nthLe (l : List α) (h : Nodup l) (n : ℕ) (hn : n < l.length) :
    prev l (l.nthLe n hn) (nthLe_mem _ _ _) =
      l.nthLe ((n + (l.length - 1)) % l.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' l with x l
  · simp at hn
  induction' l with y l hl generalizing n x
  · simp
  · rcases n with (_ | _ | n)
    · simp [Nat.add_succ_sub_one, add_zero, List.prev_cons_cons_eq, Nat.zero_eq, List.length,
        List.nthLe, Nat.succ_add_sub_one, zero_add, getLast_eq_get,
        Nat.mod_eq_of_lt (Nat.succ_lt_succ l.length.lt_succ_self)]
    · simp only [mem_cons, nodup_cons] at h
      push_neg at h
      simp only [List.prev_cons_cons_of_ne _ _ _ _ h.left.left.symm, Nat.zero_eq, List.length,
        List.nthLe, add_comm, eq_self_iff_true, Nat.succ_add_sub_one, Nat.mod_self, zero_add,
        List.get]
    · rw [prev_ne_cons_cons]
      · convert hl n.succ y h.of_cons (Nat.le_of_succ_le_succ hn) using 1
        have : ∀ k hk, (y :: l).nthLe k hk = (x :: y :: l).nthLe (k + 1) (Nat.succ_lt_succ hk) := by
          intros
          simp [List.nthLe]
        rw [this]
        congr
        simp only [Nat.add_succ_sub_one, add_zero, length]
        simp only [length, Nat.succ_lt_succ_iff] at hn
        set k := l.length
        rw [Nat.succ_add, ← Nat.add_succ, Nat.add_mod_right, Nat.succ_add, ← Nat.add_succ _ k,
          Nat.add_mod_right, Nat.mod_eq_of_lt, Nat.mod_eq_of_lt]
        · exact Nat.lt_succ_of_lt hn
        · exact Nat.succ_lt_succ (Nat.lt_succ_of_lt hn)
      · intro H
        suffices n.succ.succ = 0 by simpa
        rw [nodup_iff_nthLe_inj] at h
        

Proof state:
case cons.cons.succ.succ.hy
α : Type u_1
inst✝ : DecidableEq α
l✝ : List α
x✝ y : α
l : List α
hl :
  ∀ (n : ℕ) (x : α),
    Nodup (x :: l) →
      ∀ (hn : n < length (x :: l)),
        prev (x :: l) (nthLe (x :: l) n hn) (_ : nthLe (x :: l) n hn ∈ x :: l) =
          nthLe (x :: l) ((n + (length (x :: l) - 1)) % length (x :: l))
            (_ : (n + (length (x :: l) - 1)) % length (x :: l) < length (x :: l))
x : α
h :
  ∀ (i j : ℕ) (h₁ : i < length (x :: y :: l)) (h₂ : j < length (x :: y :: l)),
    nthLe (x :: y :: l) i h₁ = nthLe (x :: y :: l) j h₂ → i = j
n : ℕ
hn : Nat.succ (Nat.succ n) < length (x :: y :: l)
H : nthLe (x :: y :: l) (Nat.succ (Nat.succ n)) hn = x
⊢ Nat.succ (Nat.succ n) = 0

Next tactic:
refine' h _ _ hn Nat.succ_pos' _
set_option linter.deprecated false in
theorem prev_nthLe (l : List α) (h : Nodup l) (n : ℕ) (hn : n < l.length) :
    prev l (l.nthLe n hn) (nthLe_mem _ _ _) =
      l.nthLe ((n + (l.length - 1)) % l.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' l with x l
  · simp at hn
  induction' l with y l hl generalizing n x
  · simp
  · rcases n with (_ | _ | n)
    · simp [Nat.add_succ_sub_one, add_zero, List.prev_cons_cons_eq, Nat.zero_eq, List.length,
        List.nthLe, Nat.succ_add_sub_one, zero_add, getLast_eq_get,
        Nat.mod_eq_of_lt (Nat.succ_lt_succ l.length.lt_succ_self)]
    · simp only [mem_cons, nodup_cons] at h
      push_neg at h
      simp only [List.prev_cons_cons_of_ne _ _ _ _ h.left.left.symm, Nat.zero_eq, List.length,
        List.nthLe, add_comm, eq_self_iff_true, Nat.succ_add_sub_one, Nat.mod_self, zero_add,
        List.get]
    · rw [prev_ne_cons_cons]
      · convert hl n.succ y h.of_cons (Nat.le_of_succ_le_succ hn) using 1
        have : ∀ k hk, (y :: l).nthLe k hk = (x :: y :: l).nthLe (k + 1) (Nat.succ_lt_succ hk) := by
          intros
          simp [List.nthLe]
        rw [this]
        congr
        simp only [Nat.add_succ_sub_one, add_zero, length]
        simp only [length, Nat.succ_lt_succ_iff] at hn
        set k := l.length
        rw [Nat.succ_add, ← Nat.add_succ, Nat.add_mod_right, Nat.succ_add, ← Nat.add_succ _ k,
          Nat.add_mod_right, Nat.mod_eq_of_lt, Nat.mod_eq_of_lt]
        · exact Nat.lt_succ_of_lt hn
        · exact Nat.succ_lt_succ (Nat.lt_succ_of_lt hn)
      · intro H
        suffices n.succ.succ = 0 by simpa
        rw [nodup_iff_nthLe_inj] at h
        refine' h _ _ hn Nat.succ_pos' _
        

Proof state:
case cons.cons.succ.succ.hy
α : Type u_1
inst✝ : DecidableEq α
l✝ : List α
x✝ y : α
l : List α
hl :
  ∀ (n : ℕ) (x : α),
    Nodup (x :: l) →
      ∀ (hn : n < length (x :: l)),
        prev (x :: l) (nthLe (x :: l) n hn) (_ : nthLe (x :: l) n hn ∈ x :: l) =
          nthLe (x :: l) ((n + (length (x :: l) - 1)) % length (x :: l))
            (_ : (n + (length (x :: l) - 1)) % length (x :: l) < length (x :: l))
x : α
h :
  ∀ (i j : ℕ) (h₁ : i < length (x :: y :: l)) (h₂ : j < length (x :: y :: l)),
    nthLe (x :: y :: l) i h₁ = nthLe (x :: y :: l) j h₂ → i = j
n : ℕ
hn : Nat.succ (Nat.succ n) < length (x :: y :: l)
H : nthLe (x :: y :: l) (Nat.succ (Nat.succ n)) hn = x
⊢ nthLe (x :: y :: l) (Nat.succ (Nat.succ n)) hn = nthLe (x :: y :: l) 0 (_ : 0 < Nat.succ (length (y :: l)))

Next tactic:
simpa using H