l3lab/ntp-mathlib huggingface dataset:
set_option linter.deprecated false in
theorem formPerm_apply_lt (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n + 1 < xs.length) :
    formPerm xs (xs.nthLe n ((Nat.lt_succ_self n).trans hn)) = xs.nthLe (n + 1) hn := by
  induction' n with n IH generalizing xs
  · simpa using formPerm_apply_nthLe_zero _ h _
  · rcases xs with (_ | ⟨x, _ | ⟨y, l⟩⟩)
    · simp at hn
    · simp
    · specialize IH (y :: l) h.of_cons _
      · simpa [Nat.succ_lt_succ_iff] using hn
      simp only [swap_apply_eq_iff, coe_mul, formPerm_cons_cons, Function.comp]
      simp only [nthLe, get_cons_succ] at *
      rw [← IH, swap_apply_of_ne_of_ne] <;>
      · intro hx
        

Proof state:
case succ.cons.cons.a
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x✝ : α
n : ℕ
IH✝ :
  ∀ (xs : List α),
    Nodup xs →
      ∀ (hn : n + 1 < length xs),
        (formPerm xs) (get xs { val := n, isLt := (_ : n < length xs) }) = get xs { val := n + 1, isLt := hn }
x y : α
l : List α
h : Nodup (x :: y :: l)
hn : Nat.succ n + 1 < length (x :: y :: l)
IH :
  (formPerm (y :: l)) (get (y :: l) { val := n, isLt := (_ : n < length (y :: l)) }) =
    get l { val := n, isLt := (_ : n < length l) }
hx : (formPerm (y :: l)) (get (y :: l) { val := n, isLt := (_ : n < length (y :: l)) }) = x
⊢ False

Next tactic:
rw [← hx, IH] at h
set_option linter.deprecated false in
theorem formPerm_apply_lt (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n + 1 < xs.length) :
    formPerm xs (xs.nthLe n ((Nat.lt_succ_self n).trans hn)) = xs.nthLe (n + 1) hn := by
  induction' n with n IH generalizing xs
  · simpa using formPerm_apply_nthLe_zero _ h _
  · rcases xs with (_ | ⟨x, _ | ⟨y, l⟩⟩)
    · simp at hn
    · simp
    · specialize IH (y :: l) h.of_cons _
      · simpa [Nat.succ_lt_succ_iff] using hn
      simp only [swap_apply_eq_iff, coe_mul, formPerm_cons_cons, Function.comp]
      simp only [nthLe, get_cons_succ] at *
      rw [← IH, swap_apply_of_ne_of_ne] <;>
      · intro hx
        rw [← hx, IH] at h
        

Proof state:
case succ.cons.cons.a
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x✝ : α
n : ℕ
IH✝ :
  ∀ (xs : List α),
    Nodup xs →
      ∀ (hn : n + 1 < length xs),
        (formPerm xs) (get xs { val := n, isLt := (_ : n < length xs) }) = get xs { val := n + 1, isLt := hn }
x y : α
l : List α
hn : Nat.succ n + 1 < length (x :: y :: l)
h : Nodup (get l { val := n, isLt := (_ : n < length l) } :: y :: l)
IH :
  (formPerm (y :: l)) (get (y :: l) { val := n, isLt := (_ : n < length (y :: l)) }) =
    get l { val := n, isLt := (_ : n < length l) }
hx : (formPerm (y :: l)) (get (y :: l) { val := n, isLt := (_ : n < length (y :: l)) }) = x
⊢ False

Next tactic:
simp [get_mem] at h
set_option linter.deprecated false in
theorem formPerm_apply_lt (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n + 1 < xs.length) :
    formPerm xs (xs.nthLe n ((Nat.lt_succ_self n).trans hn)) = xs.nthLe (n + 1) hn := by
  induction' n with n IH generalizing xs
  · simpa using formPerm_apply_nthLe_zero _ h _
  · rcases xs with (_ | ⟨x, _ | ⟨y, l⟩⟩)
    · simp at hn
    · simp
    · specialize IH (y :: l) h.of_cons _
      · simpa [Nat.succ_lt_succ_iff] using hn
      simp only [swap_apply_eq_iff, coe_mul, formPerm_cons_cons, Function.comp]
      simp only [nthLe, get_cons_succ] at *
      rw [← IH, swap_apply_of_ne_of_ne] <;>
      · 

Proof state:
case succ.cons.cons.a
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x✝ : α
n : ℕ
IH✝ :
  ∀ (xs : List α),
    Nodup xs →
      ∀ (hn : n + 1 < length xs),
        (formPerm xs) (get xs { val := n, isLt := (_ : n < length xs) }) = get xs { val := n + 1, isLt := hn }
x y : α
l : List α
h : Nodup (x :: y :: l)
hn : Nat.succ n + 1 < length (x :: y :: l)
IH :
  (formPerm (y :: l)) (get (y :: l) { val := n, isLt := (_ : n < length (y :: l)) }) =
    get l { val := n, isLt := (_ : n < length l) }
⊢ (formPerm (y :: l)) (get (y :: l) { val := n, isLt := (_ : n < length (y :: l)) }) ≠ y

Next tactic:
intro hx
set_option linter.deprecated false in
theorem formPerm_apply_lt (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n + 1 < xs.length) :
    formPerm xs (xs.nthLe n ((Nat.lt_succ_self n).trans hn)) = xs.nthLe (n + 1) hn := by
  induction' n with n IH generalizing xs
  · simpa using formPerm_apply_nthLe_zero _ h _
  · rcases xs with (_ | ⟨x, _ | ⟨y, l⟩⟩)
    · simp at hn
    · simp
    · specialize IH (y :: l) h.of_cons _
      · simpa [Nat.succ_lt_succ_iff] using hn
      simp only [swap_apply_eq_iff, coe_mul, formPerm_cons_cons, Function.comp]
      simp only [nthLe, get_cons_succ] at *
      rw [← IH, swap_apply_of_ne_of_ne] <;>
      · intro hx
        

Proof state:
case succ.cons.cons.a
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x✝ : α
n : ℕ
IH✝ :
  ∀ (xs : List α),
    Nodup xs →
      ∀ (hn : n + 1 < length xs),
        (formPerm xs) (get xs { val := n, isLt := (_ : n < length xs) }) = get xs { val := n + 1, isLt := hn }
x y : α
l : List α
h : Nodup (x :: y :: l)
hn : Nat.succ n + 1 < length (x :: y :: l)
IH :
  (formPerm (y :: l)) (get (y :: l) { val := n, isLt := (_ : n < length (y :: l)) }) =
    get l { val := n, isLt := (_ : n < length l) }
hx : (formPerm (y :: l)) (get (y :: l) { val := n, isLt := (_ : n < length (y :: l)) }) = y
⊢ False

Next tactic:
rw [← hx, IH] at h
set_option linter.deprecated false in
theorem formPerm_apply_lt (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n + 1 < xs.length) :
    formPerm xs (xs.nthLe n ((Nat.lt_succ_self n).trans hn)) = xs.nthLe (n + 1) hn := by
  induction' n with n IH generalizing xs
  · simpa using formPerm_apply_nthLe_zero _ h _
  · rcases xs with (_ | ⟨x, _ | ⟨y, l⟩⟩)
    · simp at hn
    · simp
    · specialize IH (y :: l) h.of_cons _
      · simpa [Nat.succ_lt_succ_iff] using hn
      simp only [swap_apply_eq_iff, coe_mul, formPerm_cons_cons, Function.comp]
      simp only [nthLe, get_cons_succ] at *
      rw [← IH, swap_apply_of_ne_of_ne] <;>
      · intro hx
        rw [← hx, IH] at h
        

Proof state:
case succ.cons.cons.a
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x✝ : α
n : ℕ
IH✝ :
  ∀ (xs : List α),
    Nodup xs →
      ∀ (hn : n + 1 < length xs),
        (formPerm xs) (get xs { val := n, isLt := (_ : n < length xs) }) = get xs { val := n + 1, isLt := hn }
x y : α
l : List α
hn : Nat.succ n + 1 < length (x :: y :: l)
h : Nodup (x :: get l { val := n, isLt := (_ : n < length l) } :: l)
IH :
  (formPerm (y :: l)) (get (y :: l) { val := n, isLt := (_ : n < length (y :: l)) }) =
    get l { val := n, isLt := (_ : n < length l) }
hx : (formPerm (y :: l)) (get (y :: l) { val := n, isLt := (_ : n < length (y :: l)) }) = y
⊢ False

Next tactic:
simp [get_mem] at h
set_option linter.deprecated false in
theorem formPerm_apply_nthLe (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n < xs.length) :
    formPerm xs (xs.nthLe n hn) =
      xs.nthLe ((n + 1) % xs.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x : α
xs : List α
h : Nodup xs
n : ℕ
hn : n < length xs
⊢ (formPerm xs) (nthLe xs n hn) = nthLe xs ((n + 1) % length xs) (_ : (n + 1) % length xs < length xs)

Next tactic:
cases' xs with x xs
set_option linter.deprecated false in
theorem formPerm_apply_nthLe (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n < xs.length) :
    formPerm xs (xs.nthLe n hn) =
      xs.nthLe ((n + 1) % xs.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' xs with x xs
  · 

Proof state:
case nil
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x : α
n : ℕ
h : Nodup []
hn : n < length []
⊢ (formPerm []) (nthLe [] n hn) = nthLe [] ((n + 1) % length []) (_ : (n + 1) % length [] < length [])

Next tactic:
simp at hn
set_option linter.deprecated false in
theorem formPerm_apply_nthLe (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n < xs.length) :
    formPerm xs (xs.nthLe n hn) =
      xs.nthLe ((n + 1) % xs.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' xs with x xs
  · simp at hn
  · 

Proof state:
case cons
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
n : ℕ
x : α
xs : List α
h : Nodup (x :: xs)
hn : n < length (x :: xs)
⊢ (formPerm (x :: xs)) (nthLe (x :: xs) n hn) =
    nthLe (x :: xs) ((n + 1) % length (x :: xs)) (_ : (n + 1) % length (x :: xs) < length (x :: xs))

Next tactic:
have : n ≤ xs.length := by
      refine' Nat.le_of_lt_succ _
      simpa using hn
set_option linter.deprecated false in
theorem formPerm_apply_nthLe (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n < xs.length) :
    formPerm xs (xs.nthLe n hn) =
      xs.nthLe ((n + 1) % xs.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' xs with x xs
  · simp at hn
  · have : n ≤ xs.length := by
      

Proof state:
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
n : ℕ
x : α
xs : List α
h : Nodup (x :: xs)
hn : n < length (x :: xs)
⊢ n ≤ length xs

Next tactic:
refine' Nat.le_of_lt_succ _
set_option linter.deprecated false in
theorem formPerm_apply_nthLe (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n < xs.length) :
    formPerm xs (xs.nthLe n hn) =
      xs.nthLe ((n + 1) % xs.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' xs with x xs
  · simp at hn
  · have : n ≤ xs.length := by
      refine' Nat.le_of_lt_succ _
      

Proof state:
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
n : ℕ
x : α
xs : List α
h : Nodup (x :: xs)
hn : n < length (x :: xs)
⊢ n < Nat.succ (length xs)

Next tactic:
simpa using hn
set_option linter.deprecated false in
theorem formPerm_apply_nthLe (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n < xs.length) :
    formPerm xs (xs.nthLe n hn) =
      xs.nthLe ((n + 1) % xs.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' xs with x xs
  · simp at hn
  · have : n ≤ xs.length := by
      refine' Nat.le_of_lt_succ _
      simpa using hn
    

Proof state:
case cons
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
n : ℕ
x : α
xs : List α
h : Nodup (x :: xs)
hn : n < length (x :: xs)
this : n ≤ length xs
⊢ (formPerm (x :: xs)) (nthLe (x :: xs) n hn) =
    nthLe (x :: xs) ((n + 1) % length (x :: xs)) (_ : (n + 1) % length (x :: xs) < length (x :: xs))

Next tactic:
rcases this.eq_or_lt with (rfl | hn')
set_option linter.deprecated false in
theorem formPerm_apply_nthLe (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n < xs.length) :
    formPerm xs (xs.nthLe n hn) =
      xs.nthLe ((n + 1) % xs.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' xs with x xs
  · simp at hn
  · have : n ≤ xs.length := by
      refine' Nat.le_of_lt_succ _
      simpa using hn
    rcases this.eq_or_lt with (rfl | hn')
    · 

Proof state:
case cons.inl
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ x : α
xs : List α
h : Nodup (x :: xs)
hn : length xs < length (x :: xs)
this : length xs ≤ length xs
⊢ (formPerm (x :: xs)) (nthLe (x :: xs) (length xs) hn) =
    nthLe (x :: xs) ((length xs + 1) % length (x :: xs)) (_ : (length xs + 1) % length (x :: xs) < length (x :: xs))

Next tactic:
simp
set_option linter.deprecated false in
theorem formPerm_apply_nthLe (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n < xs.length) :
    formPerm xs (xs.nthLe n hn) =
      xs.nthLe ((n + 1) % xs.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' xs with x xs
  · simp at hn
  · have : n ≤ xs.length := by
      refine' Nat.le_of_lt_succ _
      simpa using hn
    rcases this.eq_or_lt with (rfl | hn')
    · simp; 

Proof state:
case cons.inl
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ x : α
xs : List α
h : Nodup (x :: xs)
hn : length xs < length (x :: xs)
this : length xs ≤ length xs
⊢ x = nthLe (x :: xs) 0 (_ : 0 < length (x :: xs))

Next tactic:
simp [nthLe]
set_option linter.deprecated false in
theorem formPerm_apply_nthLe (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n < xs.length) :
    formPerm xs (xs.nthLe n hn) =
      xs.nthLe ((n + 1) % xs.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' xs with x xs
  · simp at hn
  · have : n ≤ xs.length := by
      refine' Nat.le_of_lt_succ _
      simpa using hn
    rcases this.eq_or_lt with (rfl | hn')
    · simp; simp [nthLe]
    · 

Proof state:
case cons.inr
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
n : ℕ
x : α
xs : List α
h : Nodup (x :: xs)
hn : n < length (x :: xs)
this : n ≤ length xs
hn' : n < length xs
⊢ (formPerm (x :: xs)) (nthLe (x :: xs) n hn) =
    nthLe (x :: xs) ((n + 1) % length (x :: xs)) (_ : (n + 1) % length (x :: xs) < length (x :: xs))

Next tactic:
rw [formPerm_apply_lt _ h _ (Nat.succ_lt_succ hn')]
set_option linter.deprecated false in
theorem formPerm_apply_nthLe (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n < xs.length) :
    formPerm xs (xs.nthLe n hn) =
      xs.nthLe ((n + 1) % xs.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' xs with x xs
  · simp at hn
  · have : n ≤ xs.length := by
      refine' Nat.le_of_lt_succ _
      simpa using hn
    rcases this.eq_or_lt with (rfl | hn')
    · simp; simp [nthLe]
    · rw [formPerm_apply_lt _ h _ (Nat.succ_lt_succ hn')]
      

Proof state:
case cons.inr
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
n : ℕ
x : α
xs : List α
h : Nodup (x :: xs)
hn : n < length (x :: xs)
this : n ≤ length xs
hn' : n < length xs
⊢ nthLe (x :: xs) (n + 1) (_ : Nat.succ n < Nat.succ (length xs)) =
    nthLe (x :: xs) ((n + 1) % length (x :: xs)) (_ : (n + 1) % length (x :: xs) < length (x :: xs))

Next tactic:
congr
set_option linter.deprecated false in
theorem formPerm_apply_nthLe (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n < xs.length) :
    formPerm xs (xs.nthLe n hn) =
      xs.nthLe ((n + 1) % xs.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' xs with x xs
  · simp at hn
  · have : n ≤ xs.length := by
      refine' Nat.le_of_lt_succ _
      simpa using hn
    rcases this.eq_or_lt with (rfl | hn')
    · simp; simp [nthLe]
    · rw [formPerm_apply_lt _ h _ (Nat.succ_lt_succ hn')]
      congr
      

Proof state:
case cons.inr.e_n
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
n : ℕ
x : α
xs : List α
h : Nodup (x :: xs)
hn : n < length (x :: xs)
this : n ≤ length xs
hn' : n < length xs
⊢ n + 1 = (n + 1) % length (x :: xs)

Next tactic:
rw [Nat.mod_eq_of_lt]
set_option linter.deprecated false in
theorem formPerm_apply_nthLe (xs : List α) (h : Nodup xs) (n : ℕ) (hn : n < xs.length) :
    formPerm xs (xs.nthLe n hn) =
      xs.nthLe ((n + 1) % xs.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) := by
  cases' xs with x xs
  · simp at hn
  · have : n ≤ xs.length := by
      refine' Nat.le_of_lt_succ _
      simpa using hn
    rcases this.eq_or_lt with (rfl | hn')
    · simp; simp [nthLe]
    · rw [formPerm_apply_lt _ h _ (Nat.succ_lt_succ hn')]
      congr
      rw [Nat.mod_eq_of_lt]; 

Proof state:
case cons.inr.e_n
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l : List α
x✝ : α
n : ℕ
x : α
xs : List α
h : Nodup (x :: xs)
hn : n < length (x :: xs)
this : n ≤ length xs
hn' : n < length xs
⊢ n + 1 < length (x :: xs)

Next tactic:
simpa [Nat.succ_eq_add_one]
set_option linter.deprecated false in
theorem support_formPerm_of_nodup' (l : List α) (h : Nodup l) (h' : ∀ x : α, l ≠ [x]) :
    { x | formPerm l x ≠ x } = l.toFinset := by
  

Proof state:
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x : α
l : List α
h : Nodup l
h' : ∀ (x : α), l ≠ [x]
⊢ {x | (formPerm l) x ≠ x} = ↑(toFinset l)

Next tactic:
apply _root_.le_antisymm
set_option linter.deprecated false in
theorem support_formPerm_of_nodup' (l : List α) (h : Nodup l) (h' : ∀ x : α, l ≠ [x]) :
    { x | formPerm l x ≠ x } = l.toFinset := by
  apply _root_.le_antisymm
  · 

Proof state:
case a
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x : α
l : List α
h : Nodup l
h' : ∀ (x : α), l ≠ [x]
⊢ {x | (formPerm l) x ≠ x} ≤ ↑(toFinset l)

Next tactic:
exact support_formPerm_le' l
set_option linter.deprecated false in
theorem support_formPerm_of_nodup' (l : List α) (h : Nodup l) (h' : ∀ x : α, l ≠ [x]) :
    { x | formPerm l x ≠ x } = l.toFinset := by
  apply _root_.le_antisymm
  · exact support_formPerm_le' l
  · 

Proof state:
case a
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x : α
l : List α
h : Nodup l
h' : ∀ (x : α), l ≠ [x]
⊢ ↑(toFinset l) ≤ {x | (formPerm l) x ≠ x}

Next tactic:
intro x hx
set_option linter.deprecated false in
theorem support_formPerm_of_nodup' (l : List α) (h : Nodup l) (h' : ∀ x : α, l ≠ [x]) :
    { x | formPerm l x ≠ x } = l.toFinset := by
  apply _root_.le_antisymm
  · exact support_formPerm_le' l
  · intro x hx
    

Proof state:
case a
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x✝ : α
l : List α
h : Nodup l
h' : ∀ (x : α), l ≠ [x]
x : α
hx : x ∈ ↑(toFinset l)
⊢ x ∈ {x | (formPerm l) x ≠ x}

Next tactic:
simp only [Finset.mem_coe, mem_toFinset] at hx
set_option linter.deprecated false in
theorem support_formPerm_of_nodup' (l : List α) (h : Nodup l) (h' : ∀ x : α, l ≠ [x]) :
    { x | formPerm l x ≠ x } = l.toFinset := by
  apply _root_.le_antisymm
  · exact support_formPerm_le' l
  · intro x hx
    simp only [Finset.mem_coe, mem_toFinset] at hx
    

Proof state:
case a
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x✝ : α
l : List α
h : Nodup l
h' : ∀ (x : α), l ≠ [x]
x : α
hx : x ∈ l
⊢ x ∈ {x | (formPerm l) x ≠ x}

Next tactic:
obtain ⟨n, hn, rfl⟩ := nthLe_of_mem hx
set_option linter.deprecated false in
theorem support_formPerm_of_nodup' (l : List α) (h : Nodup l) (h' : ∀ x : α, l ≠ [x]) :
    { x | formPerm l x ≠ x } = l.toFinset := by
  apply _root_.le_antisymm
  · exact support_formPerm_le' l
  · intro x hx
    simp only [Finset.mem_coe, mem_toFinset] at hx
    obtain ⟨n, hn, rfl⟩ := nthLe_of_mem hx
    

Proof state:
case a.intro.intro
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x : α
l : List α
h : Nodup l
h' : ∀ (x : α), l ≠ [x]
n : ℕ
hn : n < length l
hx : nthLe l n hn ∈ l
⊢ nthLe l n hn ∈ {x | (formPerm l) x ≠ x}

Next tactic:
rw [Set.mem_setOf_eq, formPerm_apply_nthLe _ h]
set_option linter.deprecated false in
theorem support_formPerm_of_nodup' (l : List α) (h : Nodup l) (h' : ∀ x : α, l ≠ [x]) :
    { x | formPerm l x ≠ x } = l.toFinset := by
  apply _root_.le_antisymm
  · exact support_formPerm_le' l
  · intro x hx
    simp only [Finset.mem_coe, mem_toFinset] at hx
    obtain ⟨n, hn, rfl⟩ := nthLe_of_mem hx
    rw [Set.mem_setOf_eq, formPerm_apply_nthLe _ h]
    

Proof state:
case a.intro.intro
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x : α
l : List α
h : Nodup l
h' : ∀ (x : α), l ≠ [x]
n : ℕ
hn : n < length l
hx : nthLe l n hn ∈ l
⊢ nthLe l ((n + 1) % length l) (_ : (n + 1) % length l < length l) ≠ nthLe l n hn

Next tactic:
intro H
set_option linter.deprecated false in
theorem support_formPerm_of_nodup' (l : List α) (h : Nodup l) (h' : ∀ x : α, l ≠ [x]) :
    { x | formPerm l x ≠ x } = l.toFinset := by
  apply _root_.le_antisymm
  · exact support_formPerm_le' l
  · intro x hx
    simp only [Finset.mem_coe, mem_toFinset] at hx
    obtain ⟨n, hn, rfl⟩ := nthLe_of_mem hx
    rw [Set.mem_setOf_eq, formPerm_apply_nthLe _ h]
    intro H
    

Proof state:
case a.intro.intro
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x : α
l : List α
h : Nodup l
h' : ∀ (x : α), l ≠ [x]
n : ℕ
hn : n < length l
hx : nthLe l n hn ∈ l
H : nthLe l ((n + 1) % length l) (_ : (n + 1) % length l < length l) = nthLe l n hn
⊢ False

Next tactic:
rw [nodup_iff_nthLe_inj] at h
set_option linter.deprecated false in
theorem support_formPerm_of_nodup' (l : List α) (h : Nodup l) (h' : ∀ x : α, l ≠ [x]) :
    { x | formPerm l x ≠ x } = l.toFinset := by
  apply _root_.le_antisymm
  · exact support_formPerm_le' l
  · intro x hx
    simp only [Finset.mem_coe, mem_toFinset] at hx
    obtain ⟨n, hn, rfl⟩ := nthLe_of_mem hx
    rw [Set.mem_setOf_eq, formPerm_apply_nthLe _ h]
    intro H
    rw [nodup_iff_nthLe_inj] at h
    

Proof state:
case a.intro.intro
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x : α
l : List α
h : ∀ (i j : ℕ) (h₁ : i < length l) (h₂ : j < length l), nthLe l i h₁ = nthLe l j h₂ → i = j
h' : ∀ (x : α), l ≠ [x]
n : ℕ
hn : n < length l
hx : nthLe l n hn ∈ l
H : nthLe l ((n + 1) % length l) (_ : (n + 1) % length l < length l) = nthLe l n hn
⊢ False

Next tactic:
specialize h _ _ _ _ H
set_option linter.deprecated false in
theorem support_formPerm_of_nodup' (l : List α) (h : Nodup l) (h' : ∀ x : α, l ≠ [x]) :
    { x | formPerm l x ≠ x } = l.toFinset := by
  apply _root_.le_antisymm
  · exact support_formPerm_le' l
  · intro x hx
    simp only [Finset.mem_coe, mem_toFinset] at hx
    obtain ⟨n, hn, rfl⟩ := nthLe_of_mem hx
    rw [Set.mem_setOf_eq, formPerm_apply_nthLe _ h]
    intro H
    rw [nodup_iff_nthLe_inj] at h
    specialize h _ _ _ _ H
    

Proof state:
case a.intro.intro
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x : α
l : List α
h' : ∀ (x : α), l ≠ [x]
n : ℕ
hn : n < length l
hx : nthLe l n hn ∈ l
H : nthLe l ((n + 1) % length l) (_ : (n + 1) % length l < length l) = nthLe l n hn
h : (n + 1) % length l = n
⊢ False

Next tactic:
rcases (Nat.succ_le_of_lt hn).eq_or_lt with hn' | hn'
set_option linter.deprecated false in
theorem support_formPerm_of_nodup' (l : List α) (h : Nodup l) (h' : ∀ x : α, l ≠ [x]) :
    { x | formPerm l x ≠ x } = l.toFinset := by
  apply _root_.le_antisymm
  · exact support_formPerm_le' l
  · intro x hx
    simp only [Finset.mem_coe, mem_toFinset] at hx
    obtain ⟨n, hn, rfl⟩ := nthLe_of_mem hx
    rw [Set.mem_setOf_eq, formPerm_apply_nthLe _ h]
    intro H
    rw [nodup_iff_nthLe_inj] at h
    specialize h _ _ _ _ H
    rcases (Nat.succ_le_of_lt hn).eq_or_lt with hn' | hn'
    · 

Proof state:
case a.intro.intro.inl
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x : α
l : List α
h' : ∀ (x : α), l ≠ [x]
n : ℕ
hn : n < length l
hx : nthLe l n hn ∈ l
H : nthLe l ((n + 1) % length l) (_ : (n + 1) % length l < length l) = nthLe l n hn
h : (n + 1) % length l = n
hn' : Nat.succ n = length l
⊢ False

Next tactic:
simp only [← hn', Nat.mod_self] at h
set_option linter.deprecated false in
theorem support_formPerm_of_nodup' (l : List α) (h : Nodup l) (h' : ∀ x : α, l ≠ [x]) :
    { x | formPerm l x ≠ x } = l.toFinset := by
  apply _root_.le_antisymm
  · exact support_formPerm_le' l
  · intro x hx
    simp only [Finset.mem_coe, mem_toFinset] at hx
    obtain ⟨n, hn, rfl⟩ := nthLe_of_mem hx
    rw [Set.mem_setOf_eq, formPerm_apply_nthLe _ h]
    intro H
    rw [nodup_iff_nthLe_inj] at h
    specialize h _ _ _ _ H
    rcases (Nat.succ_le_of_lt hn).eq_or_lt with hn' | hn'
    · simp only [← hn', Nat.mod_self] at h
      

Proof state:
case a.intro.intro.inl
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x : α
l : List α
h' : ∀ (x : α), l ≠ [x]
n : ℕ
hn : n < length l
hx : nthLe l n hn ∈ l
H : nthLe l ((n + 1) % length l) (_ : (n + 1) % length l < length l) = nthLe l n hn
hn' : Nat.succ n = length l
h : 0 = n
⊢ False

Next tactic:
refine' not_exists.mpr h' _
set_option linter.deprecated false in
theorem support_formPerm_of_nodup' (l : List α) (h : Nodup l) (h' : ∀ x : α, l ≠ [x]) :
    { x | formPerm l x ≠ x } = l.toFinset := by
  apply _root_.le_antisymm
  · exact support_formPerm_le' l
  · intro x hx
    simp only [Finset.mem_coe, mem_toFinset] at hx
    obtain ⟨n, hn, rfl⟩ := nthLe_of_mem hx
    rw [Set.mem_setOf_eq, formPerm_apply_nthLe _ h]
    intro H
    rw [nodup_iff_nthLe_inj] at h
    specialize h _ _ _ _ H
    rcases (Nat.succ_le_of_lt hn).eq_or_lt with hn' | hn'
    · simp only [← hn', Nat.mod_self] at h
      refine' not_exists.mpr h' _
      

Proof state:
case a.intro.intro.inl
α : Type u_1
β : Type u_2
inst✝ : DecidableEq α
l✝ : List α
x : α
l : List α
h' : ∀ (x : α), l ≠ [x]
n : ℕ
hn : n < length l
hx : nthLe l n hn ∈ l
H : nthLe l ((n + 1) % length l) (_ : (n + 1) % length l < length l) = nthLe l n hn
hn' : Nat.succ n = length l
h : 0 = n
⊢ ∃ x, l = [x]

Next tactic:
rw [← length_eq_one]