l3lab/ntp-mathlib huggingface dataset:
theorem isRotated_concat (hd : α) (tl : List α) : (tl ++ [hd]) ~r (hd :: tl) :=
  IsRotated.symm ⟨1, by 

Proof state:
α : Type u
l l' : List α
hd : α
tl : List α
⊢ rotate (hd :: tl) 1 = tl ++ [hd]

Next tactic:
simp
theorem isRotated_append : (l ++ l') ~r (l' ++ l) :=
  ⟨l.length, by 

Proof state:
α : Type u
l l' : List α
⊢ rotate (l ++ l') (length l) = l' ++ l

Next tactic:
simp
theorem IsRotated.reverse (h : l ~r l') : l.reverse ~r l'.reverse := by
  

Proof state:
α : Type u
l l' : List α
h : l ~r l'
⊢ List.reverse l ~r List.reverse l'

Next tactic:
obtain ⟨n, rfl⟩ := h
theorem IsRotated.reverse (h : l ~r l') : l.reverse ~r l'.reverse := by
  obtain ⟨n, rfl⟩ := h
  

Proof state:
case intro
α : Type u
l : List α
n : ℕ
⊢ List.reverse l ~r List.reverse (rotate l n)

Next tactic:
exact ⟨_, (reverse_rotate _ _).symm⟩
theorem isRotated_reverse_comm_iff : l.reverse ~r l' ↔ l ~r l'.reverse := by
  

Proof state:
α : Type u
l l' : List α
⊢ reverse l ~r l' ↔ l ~r reverse l'

Next tactic:
constructor
theorem isRotated_reverse_comm_iff : l.reverse ~r l' ↔ l ~r l'.reverse := by
  constructor <;>
    · 

Proof state:
case mp
α : Type u
l l' : List α
⊢ reverse l ~r l' → l ~r reverse l'

Next tactic:
intro h
theorem isRotated_reverse_comm_iff : l.reverse ~r l' ↔ l ~r l'.reverse := by
  constructor <;>
    · intro h
      

Proof state:
case mp
α : Type u
l l' : List α
h : reverse l ~r l'
⊢ l ~r reverse l'

Next tactic:
simpa using h.reverse
theorem isRotated_reverse_comm_iff : l.reverse ~r l' ↔ l ~r l'.reverse := by
  constructor <;>
    · 

Proof state:
case mpr
α : Type u
l l' : List α
⊢ l ~r reverse l' → reverse l ~r l'

Next tactic:
intro h
theorem isRotated_reverse_comm_iff : l.reverse ~r l' ↔ l ~r l'.reverse := by
  constructor <;>
    · intro h
      

Proof state:
case mpr
α : Type u
l l' : List α
h : l ~r reverse l'
⊢ reverse l ~r l'

Next tactic:
simpa using h.reverse
@[simp]
theorem isRotated_reverse_iff : l.reverse ~r l'.reverse ↔ l ~r l' := by
  

Proof state:
α : Type u
l l' : List α
⊢ reverse l ~r reverse l' ↔ l ~r l'

Next tactic:
simp [isRotated_reverse_comm_iff]
theorem isRotated_iff_mod : l ~r l' ↔ ∃ n ≤ l.length, l.rotate n = l' := by
  

Proof state:
α : Type u
l l' : List α
⊢ l ~r l' ↔ ∃ n ≤ length l, rotate l n = l'

Next tactic:
refine' ⟨fun h => _, fun ⟨n, _, h⟩ => ⟨n, h⟩⟩
theorem isRotated_iff_mod : l ~r l' ↔ ∃ n ≤ l.length, l.rotate n = l' := by
  refine' ⟨fun h => _, fun ⟨n, _, h⟩ => ⟨n, h⟩⟩
  

Proof state:
α : Type u
l l' : List α
h : l ~r l'
⊢ ∃ n ≤ length l, rotate l n = l'

Next tactic:
obtain ⟨n, rfl⟩ := h
theorem isRotated_iff_mod : l ~r l' ↔ ∃ n ≤ l.length, l.rotate n = l' := by
  refine' ⟨fun h => _, fun ⟨n, _, h⟩ => ⟨n, h⟩⟩
  obtain ⟨n, rfl⟩ := h
  

Proof state:
case intro
α : Type u
l : List α
n : ℕ
⊢ ∃ n_1 ≤ length l, rotate l n_1 = rotate l n

Next tactic:
cases' l with hd tl
theorem isRotated_iff_mod : l ~r l' ↔ ∃ n ≤ l.length, l.rotate n = l' := by
  refine' ⟨fun h => _, fun ⟨n, _, h⟩ => ⟨n, h⟩⟩
  obtain ⟨n, rfl⟩ := h
  cases' l with hd tl
  · 

Proof state:
case intro.nil
α : Type u
n : ℕ
⊢ ∃ n_1 ≤ length [], rotate [] n_1 = rotate [] n

Next tactic:
simp
theorem isRotated_iff_mod : l ~r l' ↔ ∃ n ≤ l.length, l.rotate n = l' := by
  refine' ⟨fun h => _, fun ⟨n, _, h⟩ => ⟨n, h⟩⟩
  obtain ⟨n, rfl⟩ := h
  cases' l with hd tl
  · simp
  · 

Proof state:
case intro.cons
α : Type u
n : ℕ
hd : α
tl : List α
⊢ ∃ n_1 ≤ length (hd :: tl), rotate (hd :: tl) n_1 = rotate (hd :: tl) n

Next tactic:
refine' ⟨n % (hd :: tl).length, _, rotate_mod _ _⟩
theorem isRotated_iff_mod : l ~r l' ↔ ∃ n ≤ l.length, l.rotate n = l' := by
  refine' ⟨fun h => _, fun ⟨n, _, h⟩ => ⟨n, h⟩⟩
  obtain ⟨n, rfl⟩ := h
  cases' l with hd tl
  · simp
  · refine' ⟨n % (hd :: tl).length, _, rotate_mod _ _⟩
    

Proof state:
case intro.cons
α : Type u
n : ℕ
hd : α
tl : List α
⊢ n % length (hd :: tl) ≤ length (hd :: tl)

Next tactic:
refine' (Nat.mod_lt _ _).le
theorem isRotated_iff_mod : l ~r l' ↔ ∃ n ≤ l.length, l.rotate n = l' := by
  refine' ⟨fun h => _, fun ⟨n, _, h⟩ => ⟨n, h⟩⟩
  obtain ⟨n, rfl⟩ := h
  cases' l with hd tl
  · simp
  · refine' ⟨n % (hd :: tl).length, _, rotate_mod _ _⟩
    refine' (Nat.mod_lt _ _).le
    

Proof state:
case intro.cons
α : Type u
n : ℕ
hd : α
tl : List α
⊢ length (hd :: tl) > 0

Next tactic:
simp
theorem isRotated_iff_mem_map_range : l ~r l' ↔ l' ∈ (List.range (l.length + 1)).map l.rotate := by
  

Proof state:
α : Type u
l l' : List α
⊢ l ~r l' ↔ l' ∈ map (rotate l) (range (length l + 1))

Next tactic:
simp_rw [mem_map, mem_range, isRotated_iff_mod]
theorem isRotated_iff_mem_map_range : l ~r l' ↔ l' ∈ (List.range (l.length + 1)).map l.rotate := by
  simp_rw [mem_map, mem_range, isRotated_iff_mod]
  

Proof state:
α : Type u
l l' : List α
⊢ (∃ n ≤ length l, rotate l n = l') ↔ ∃ a < length l + 1, rotate l a = l'

Next tactic:
exact
    ⟨fun ⟨n, hn, h⟩ => ⟨n, Nat.lt_succ_of_le hn, h⟩,
      fun ⟨n, hn, h⟩ => ⟨n, Nat.le_of_lt_succ hn, h⟩⟩
theorem IsRotated.map {β : Type*} {l₁ l₂ : List α} (h : l₁ ~r l₂) (f : α → β) :
    map f l₁ ~r map f l₂ := by
  

Proof state:
α : Type u
l l' : List α
β : Type u_1
l₁ l₂ : List α
h : l₁ ~r l₂
f : α → β
⊢ List.map f l₁ ~r List.map f l₂

Next tactic:
obtain ⟨n, rfl⟩ := h
theorem IsRotated.map {β : Type*} {l₁ l₂ : List α} (h : l₁ ~r l₂) (f : α → β) :
    map f l₁ ~r map f l₂ := by
  obtain ⟨n, rfl⟩ := h
  

Proof state:
case intro
α : Type u
l l' : List α
β : Type u_1
l₁ : List α
f : α → β
n : ℕ
⊢ List.map f l₁ ~r List.map f (rotate l₁ n)

Next tactic:
rw [map_rotate]
theorem IsRotated.map {β : Type*} {l₁ l₂ : List α} (h : l₁ ~r l₂) (f : α → β) :
    map f l₁ ~r map f l₂ := by
  obtain ⟨n, rfl⟩ := h
  rw [map_rotate]
  

Proof state:
case intro
α : Type u
l l' : List α
β : Type u_1
l₁ : List α
f : α → β
n : ℕ
⊢ List.map f l₁ ~r rotate (List.map f l₁) n

Next tactic:
use n
theorem cyclicPermutations_of_ne_nil (l : List α) (h : l ≠ []) :
    cyclicPermutations l = dropLast (zipWith (· ++ ·) (tails l) (inits l)) := by
  

Proof state:
α : Type u
l✝ l' l : List α
h : l ≠ []
⊢ cyclicPermutations l = dropLast (zipWith (fun x x_1 => x ++ x_1) (tails l) (inits l))

Next tactic:
obtain ⟨hd, tl, rfl⟩ := exists_cons_of_ne_nil h
theorem cyclicPermutations_of_ne_nil (l : List α) (h : l ≠ []) :
    cyclicPermutations l = dropLast (zipWith (· ++ ·) (tails l) (inits l)) := by
  obtain ⟨hd, tl, rfl⟩ := exists_cons_of_ne_nil h
  

Proof state:
case intro.intro
α : Type u
l l' : List α
hd : α
tl : List α
h : hd :: tl ≠ []
⊢ cyclicPermutations (hd :: tl) = dropLast (zipWith (fun x x_1 => x ++ x_1) (tails (hd :: tl)) (inits (hd :: tl)))

Next tactic:
exact cyclicPermutations_cons _ _
theorem length_cyclicPermutations_cons (x : α) (l : List α) :
    length (cyclicPermutations (x :: l)) = length l + 1 := by 

Proof state:
α : Type u
l✝ l' : List α
x : α
l : List α
⊢ length (cyclicPermutations (x :: l)) = length l + 1

Next tactic:
simp [cyclicPermutations_cons]
@[simp]
theorem length_cyclicPermutations_of_ne_nil (l : List α) (h : l ≠ []) :
    length (cyclicPermutations l) = length l := by 

Proof state:
α : Type u
l✝ l' l : List α
h : l ≠ []
⊢ length (cyclicPermutations l) = length l

Next tactic:
simp [cyclicPermutations_of_ne_nil _ h]
set_option linter.deprecated false in
@[simp]
theorem nthLe_cyclicPermutations (l : List α) (n : ℕ) (hn : n < length (cyclicPermutations l)) :
    nthLe (cyclicPermutations l) n hn = l.rotate n := by
  

Proof state:
α : Type u
l✝ l' l : List α
n : ℕ
hn : n < length (cyclicPermutations l)
⊢ nthLe (cyclicPermutations l) n hn = rotate l n

Next tactic:
obtain rfl | h := eq_or_ne l []
set_option linter.deprecated false in
@[simp]
theorem nthLe_cyclicPermutations (l : List α) (n : ℕ) (hn : n < length (cyclicPermutations l)) :
    nthLe (cyclicPermutations l) n hn = l.rotate n := by
  obtain rfl | h := eq_or_ne l []
  · 

Proof state:
case inl
α : Type u
l l' : List α
n : ℕ
hn : n < length (cyclicPermutations [])
⊢ nthLe (cyclicPermutations []) n hn = rotate [] n

Next tactic:
simp
set_option linter.deprecated false in
@[simp]
theorem nthLe_cyclicPermutations (l : List α) (n : ℕ) (hn : n < length (cyclicPermutations l)) :
    nthLe (cyclicPermutations l) n hn = l.rotate n := by
  obtain rfl | h := eq_or_ne l []
  · simp
  · 

Proof state:
case inr
α : Type u
l✝ l' l : List α
n : ℕ
hn : n < length (cyclicPermutations l)
h : l ≠ []
⊢ nthLe (cyclicPermutations l) n hn = rotate l n

Next tactic:
rw [length_cyclicPermutations_of_ne_nil _ h] at hn
set_option linter.deprecated false in
@[simp]
theorem nthLe_cyclicPermutations (l : List α) (n : ℕ) (hn : n < length (cyclicPermutations l)) :
    nthLe (cyclicPermutations l) n hn = l.rotate n := by
  obtain rfl | h := eq_or_ne l []
  · simp
  · rw [length_cyclicPermutations_of_ne_nil _ h] at hn
    

Proof state:
case inr
α : Type u
l✝ l' l : List α
n : ℕ
hn✝ : n < length (cyclicPermutations l)
hn : n < length l
h : l ≠ []
⊢ nthLe (cyclicPermutations l) n hn✝ = rotate l n

Next tactic:
simp [dropLast_eq_take, cyclicPermutations_of_ne_nil _ h, nthLe_take',
      rotate_eq_drop_append_take hn.le]
set_option linter.deprecated false in
theorem mem_cyclicPermutations_self (l : List α) : l ∈ cyclicPermutations l := by
  

Proof state:
α : Type u
l✝ l' l : List α
⊢ l ∈ cyclicPermutations l

Next tactic:
cases' l with x l
set_option linter.deprecated false in
theorem mem_cyclicPermutations_self (l : List α) : l ∈ cyclicPermutations l := by
  cases' l with x l
  · 

Proof state:
case nil
α : Type u
l l' : List α
⊢ [] ∈ cyclicPermutations []

Next tactic:
simp
set_option linter.deprecated false in
theorem mem_cyclicPermutations_self (l : List α) : l ∈ cyclicPermutations l := by
  cases' l with x l
  · simp
  · 

Proof state:
case cons
α : Type u
l✝ l' : List α
x : α
l : List α
⊢ x :: l ∈ cyclicPermutations (x :: l)

Next tactic:
rw [mem_iff_nthLe]
set_option linter.deprecated false in
theorem mem_cyclicPermutations_self (l : List α) : l ∈ cyclicPermutations l := by
  cases' l with x l
  · simp
  · rw [mem_iff_nthLe]
    

Proof state:
case cons
α : Type u
l✝ l' : List α
x : α
l : List α
⊢ ∃ n, ∃ (h : n < length (cyclicPermutations (x :: l))), nthLe (cyclicPermutations (x :: l)) n h = x :: l

Next tactic:
refine' ⟨0, by simp, _⟩
set_option linter.deprecated false in
theorem mem_cyclicPermutations_self (l : List α) : l ∈ cyclicPermutations l := by
  cases' l with x l
  · simp
  · rw [mem_iff_nthLe]
    refine' ⟨0, by 

Proof state:
α : Type u
l✝ l' : List α
x : α
l : List α
⊢ 0 < length (cyclicPermutations (x :: l))

Next tactic:
simp
set_option linter.deprecated false in
theorem mem_cyclicPermutations_self (l : List α) : l ∈ cyclicPermutations l := by
  cases' l with x l
  · simp
  · rw [mem_iff_nthLe]
    refine' ⟨0, by simp, _⟩
    

Proof state:
case cons
α : Type u
l✝ l' : List α
x : α
l : List α
⊢ nthLe (cyclicPermutations (x :: l)) 0 (_ : 0 < length (cyclicPermutations (x :: l))) = x :: l

Next tactic:
simp
set_option linter.deprecated false in
theorem length_mem_cyclicPermutations (l : List α) (h : l' ∈ cyclicPermutations l) :
    length l' = length l := by
  

Proof state:
α : Type u
l✝ l' l : List α
h : l' ∈ cyclicPermutations l
⊢ length l' = length l

Next tactic:
obtain ⟨k, hk, rfl⟩ := nthLe_of_mem h
set_option linter.deprecated false in
theorem length_mem_cyclicPermutations (l : List α) (h : l' ∈ cyclicPermutations l) :
    length l' = length l := by
  obtain ⟨k, hk, rfl⟩ := nthLe_of_mem h
  

Proof state:
case intro.intro
α : Type u
l✝ l : List α
k : ℕ
hk : k < length (cyclicPermutations l)
h : nthLe (cyclicPermutations l) k hk ∈ cyclicPermutations l
⊢ length (nthLe (cyclicPermutations l) k hk) = length l

Next tactic:
simp
set_option linter.deprecated false in
@[simp]
theorem mem_cyclicPermutations_iff {l l' : List α} : l ∈ cyclicPermutations l' ↔ l ~r l' := by
  

Proof state:
α : Type u
l✝ l'✝ l l' : List α
⊢ l ∈ cyclicPermutations l' ↔ l ~r l'

Next tactic:
constructor
set_option linter.deprecated false in
@[simp]
theorem mem_cyclicPermutations_iff {l l' : List α} : l ∈ cyclicPermutations l' ↔ l ~r l' := by
  constructor
  · 

Proof state:
case mp
α : Type u
l✝ l'✝ l l' : List α
⊢ l ∈ cyclicPermutations l' → l ~r l'

Next tactic:
intro h
set_option linter.deprecated false in
@[simp]
theorem mem_cyclicPermutations_iff {l l' : List α} : l ∈ cyclicPermutations l' ↔ l ~r l' := by
  constructor
  · intro h
    

Proof state:
case mp
α : Type u
l✝ l'✝ l l' : List α
h : l ∈ cyclicPermutations l'
⊢ l ~r l'

Next tactic:
obtain ⟨k, hk, rfl⟩ := nthLe_of_mem h
set_option linter.deprecated false in
@[simp]
theorem mem_cyclicPermutations_iff {l l' : List α} : l ∈ cyclicPermutations l' ↔ l ~r l' := by
  constructor
  · intro h
    obtain ⟨k, hk, rfl⟩ := nthLe_of_mem h
    

Proof state:
case mp.intro.intro
α : Type u
l l'✝ l' : List α
k : ℕ
hk : k < length (cyclicPermutations l')
h : nthLe (cyclicPermutations l') k hk ∈ cyclicPermutations l'
⊢ nthLe (cyclicPermutations l') k hk ~r l'

Next tactic:
simp
set_option linter.deprecated false in
@[simp]
theorem mem_cyclicPermutations_iff {l l' : List α} : l ∈ cyclicPermutations l' ↔ l ~r l' := by
  constructor
  · intro h
    obtain ⟨k, hk, rfl⟩ := nthLe_of_mem h
    simp
  · 

Proof state:
case mpr
α : Type u
l✝ l'✝ l l' : List α
⊢ l ~r l' → l ∈ cyclicPermutations l'

Next tactic:
intro h
set_option linter.deprecated false in
@[simp]
theorem mem_cyclicPermutations_iff {l l' : List α} : l ∈ cyclicPermutations l' ↔ l ~r l' := by
  constructor
  · intro h
    obtain ⟨k, hk, rfl⟩ := nthLe_of_mem h
    simp
  · intro h
    

Proof state:
case mpr
α : Type u
l✝ l'✝ l l' : List α
h : l ~r l'
⊢ l ∈ cyclicPermutations l'

Next tactic:
obtain ⟨k, rfl⟩ := h.symm
set_option linter.deprecated false in
@[simp]
theorem mem_cyclicPermutations_iff {l l' : List α} : l ∈ cyclicPermutations l' ↔ l ~r l' := by
  constructor
  · intro h
    obtain ⟨k, hk, rfl⟩ := nthLe_of_mem h
    simp
  · intro h
    obtain ⟨k, rfl⟩ := h.symm
    

Proof state:
case mpr.intro
α : Type u
l l'✝ l' : List α
k : ℕ
h : rotate l' k ~r l'
⊢ rotate l' k ∈ cyclicPermutations l'

Next tactic:
rw [mem_iff_nthLe]
set_option linter.deprecated false in
@[simp]
theorem mem_cyclicPermutations_iff {l l' : List α} : l ∈ cyclicPermutations l' ↔ l ~r l' := by
  constructor
  · intro h
    obtain ⟨k, hk, rfl⟩ := nthLe_of_mem h
    simp
  · intro h
    obtain ⟨k, rfl⟩ := h.symm
    rw [mem_iff_nthLe]
    

Proof state:
case mpr.intro
α : Type u
l l'✝ l' : List α
k : ℕ
h : rotate l' k ~r l'
⊢ ∃ n, ∃ (h : n < length (cyclicPermutations l')), nthLe (cyclicPermutations l') n h = rotate l' k

Next tactic:
simp only [exists_prop, nthLe_cyclicPermutations]
set_option linter.deprecated false in
@[simp]
theorem mem_cyclicPermutations_iff {l l' : List α} : l ∈ cyclicPermutations l' ↔ l ~r l' := by
  constructor
  · intro h
    obtain ⟨k, hk, rfl⟩ := nthLe_of_mem h
    simp
  · intro h
    obtain ⟨k, rfl⟩ := h.symm
    rw [mem_iff_nthLe]
    simp only [exists_prop, nthLe_cyclicPermutations]
    

Proof state:
case mpr.intro
α : Type u
l l'✝ l' : List α
k : ℕ
h : rotate l' k ~r l'
⊢ ∃ n < length (cyclicPermutations l'), rotate l' n = rotate l' k

Next tactic:
cases' l' with x l
set_option linter.deprecated false in
@[simp]
theorem mem_cyclicPermutations_iff {l l' : List α} : l ∈ cyclicPermutations l' ↔ l ~r l' := by
  constructor
  · intro h
    obtain ⟨k, hk, rfl⟩ := nthLe_of_mem h
    simp
  · intro h
    obtain ⟨k, rfl⟩ := h.symm
    rw [mem_iff_nthLe]
    simp only [exists_prop, nthLe_cyclicPermutations]
    cases' l' with x l
    · 

Proof state:
case mpr.intro.nil
α : Type u
l l' : List α
k : ℕ
h : rotate [] k ~r []
⊢ ∃ n < length (cyclicPermutations []), rotate [] n = rotate [] k

Next tactic:
simp
set_option linter.deprecated false in
@[simp]
theorem mem_cyclicPermutations_iff {l l' : List α} : l ∈ cyclicPermutations l' ↔ l ~r l' := by
  constructor
  · intro h
    obtain ⟨k, hk, rfl⟩ := nthLe_of_mem h
    simp
  · intro h
    obtain ⟨k, rfl⟩ := h.symm
    rw [mem_iff_nthLe]
    simp only [exists_prop, nthLe_cyclicPermutations]
    cases' l' with x l
    · simp
    · 

Proof state:
case mpr.intro.cons
α : Type u
l✝ l' : List α
k : ℕ
x : α
l : List α
h : rotate (x :: l) k ~r (x :: l)
⊢ ∃ n < length (cyclicPermutations (x :: l)), rotate (x :: l) n = rotate (x :: l) k

Next tactic:
refine' ⟨k % length (x :: l), _, rotate_mod _ _⟩
set_option linter.deprecated false in
@[simp]
theorem mem_cyclicPermutations_iff {l l' : List α} : l ∈ cyclicPermutations l' ↔ l ~r l' := by
  constructor
  · intro h
    obtain ⟨k, hk, rfl⟩ := nthLe_of_mem h
    simp
  · intro h
    obtain ⟨k, rfl⟩ := h.symm
    rw [mem_iff_nthLe]
    simp only [exists_prop, nthLe_cyclicPermutations]
    cases' l' with x l
    · simp
    · refine' ⟨k % length (x :: l), _, rotate_mod _ _⟩
      

Proof state:
case mpr.intro.cons
α : Type u
l✝ l' : List α
k : ℕ
x : α
l : List α
h : rotate (x :: l) k ~r (x :: l)
⊢ k % length (x :: l) < length (cyclicPermutations (x :: l))

Next tactic:
simpa using Nat.mod_lt _ (zero_lt_succ _)
@[simp]
theorem cyclicPermutations_eq_nil_iff {l : List α} : cyclicPermutations l = [[]] ↔ l = [] := by
  

Proof state:
α : Type u
l✝ l' l : List α
⊢ cyclicPermutations l = [[]] ↔ l = []

Next tactic:
refine' ⟨fun h => _, fun h => by simp [h]⟩
@[simp]
theorem cyclicPermutations_eq_nil_iff {l : List α} : cyclicPermutations l = [[]] ↔ l = [] := by
  refine' ⟨fun h => _, fun h => by 

Proof state:
α : Type u
l✝ l' l : List α
h : l = []
⊢ cyclicPermutations l = [[]]

Next tactic:
simp [h]
@[simp]
theorem cyclicPermutations_eq_nil_iff {l : List α} : cyclicPermutations l = [[]] ↔ l = [] := by
  refine' ⟨fun h => _, fun h => by simp [h]⟩
  

Proof state:
α : Type u
l✝ l' l : List α
h : cyclicPermutations l = [[]]
⊢ l = []

Next tactic:
rw [eq_comm, ← isRotated_nil_iff', ← mem_cyclicPermutations_iff, h, mem_singleton]
@[simp]
theorem cyclicPermutations_eq_singleton_iff {l : List α} {x : α} :
    cyclicPermutations l = [[x]] ↔ l = [x] := by
  

Proof state:
α : Type u
l✝ l' l : List α
x : α
⊢ cyclicPermutations l = [[x]] ↔ l = [x]

Next tactic:
refine' ⟨fun h => _, fun h => by simp [cyclicPermutations, h, dropLast_eq_take]⟩
@[simp]
theorem cyclicPermutations_eq_singleton_iff {l : List α} {x : α} :
    cyclicPermutations l = [[x]] ↔ l = [x] := by
  refine' ⟨fun h => _, fun h => by 

Proof state:
α : Type u
l✝ l' l : List α
x : α
h : l = [x]
⊢ cyclicPermutations l = [[x]]

Next tactic:
simp [cyclicPermutations, h, dropLast_eq_take]
@[simp]
theorem cyclicPermutations_eq_singleton_iff {l : List α} {x : α} :
    cyclicPermutations l = [[x]] ↔ l = [x] := by
  refine' ⟨fun h => _, fun h => by simp [cyclicPermutations, h, dropLast_eq_take]⟩
  

Proof state:
α : Type u
l✝ l' l : List α
x : α
h : cyclicPermutations l = [[x]]
⊢ l = [x]

Next tactic:
rw [eq_comm, ← isRotated_singleton_iff', ← mem_cyclicPermutations_iff, h, mem_singleton]
set_option linter.deprecated false in
/-- If a `l : List α` is `Nodup l`, then all of its cyclic permutants are distinct. -/
theorem Nodup.cyclicPermutations {l : List α} (hn : Nodup l) : Nodup (cyclicPermutations l) := by
  

Proof state:
α : Type u
l✝ l' l : List α
hn : Nodup l
⊢ Nodup (List.cyclicPermutations l)

Next tactic:
cases' l with x l
set_option linter.deprecated false in
/-- If a `l : List α` is `Nodup l`, then all of its cyclic permutants are distinct. -/
theorem Nodup.cyclicPermutations {l : List α} (hn : Nodup l) : Nodup (cyclicPermutations l) := by
  cases' l with x l
  · 

Proof state:
case nil
α : Type u
l l' : List α
hn : Nodup []
⊢ Nodup (List.cyclicPermutations [])

Next tactic:
simp
set_option linter.deprecated false in
/-- If a `l : List α` is `Nodup l`, then all of its cyclic permutants are distinct. -/
theorem Nodup.cyclicPermutations {l : List α} (hn : Nodup l) : Nodup (cyclicPermutations l) := by
  cases' l with x l
  · simp
  

Proof state:
case cons
α : Type u
l✝ l' : List α
x : α
l : List α
hn : Nodup (x :: l)
⊢ Nodup (List.cyclicPermutations (x :: l))

Next tactic:
rw [nodup_iff_nthLe_inj]
set_option linter.deprecated false in
/-- If a `l : List α` is `Nodup l`, then all of its cyclic permutants are distinct. -/
theorem Nodup.cyclicPermutations {l : List α} (hn : Nodup l) : Nodup (cyclicPermutations l) := by
  cases' l with x l
  · simp
  rw [nodup_iff_nthLe_inj]
  

Proof state:
case cons
α : Type u
l✝ l' : List α
x : α
l : List α
hn : Nodup (x :: l)
⊢ ∀ (i j : ℕ) (h₁ : i < length (List.cyclicPermutations (x :: l))) (h₂ : j < length (List.cyclicPermutations (x :: l))),
    nthLe (List.cyclicPermutations (x :: l)) i h₁ = nthLe (List.cyclicPermutations (x :: l)) j h₂ → i = j

Next tactic:
intro i j hi hj h
set_option linter.deprecated false in
/-- If a `l : List α` is `Nodup l`, then all of its cyclic permutants are distinct. -/
theorem Nodup.cyclicPermutations {l : List α} (hn : Nodup l) : Nodup (cyclicPermutations l) := by
  cases' l with x l
  · simp
  rw [nodup_iff_nthLe_inj]
  intro i j hi hj h
  

Proof state:
case cons
α : Type u
l✝ l' : List α
x : α
l : List α
hn : Nodup (x :: l)
i j : ℕ
hi : i < length (List.cyclicPermutations (x :: l))
hj : j < length (List.cyclicPermutations (x :: l))
h : nthLe (List.cyclicPermutations (x :: l)) i hi = nthLe (List.cyclicPermutations (x :: l)) j hj
⊢ i = j

Next tactic:
simp only [length_cyclicPermutations_cons] at hi hj
set_option linter.deprecated false in
/-- If a `l : List α` is `Nodup l`, then all of its cyclic permutants are distinct. -/
theorem Nodup.cyclicPermutations {l : List α} (hn : Nodup l) : Nodup (cyclicPermutations l) := by
  cases' l with x l
  · simp
  rw [nodup_iff_nthLe_inj]
  intro i j hi hj h
  simp only [length_cyclicPermutations_cons] at hi hj
  

Proof state:
case cons
α : Type u
l✝ l' : List α
x : α
l : List α
hn : Nodup (x :: l)
i j : ℕ
hi✝ : i < length (List.cyclicPermutations (x :: l))
hj✝ : j < length (List.cyclicPermutations (x :: l))
h : nthLe (List.cyclicPermutations (x :: l)) i hi✝ = nthLe (List.cyclicPermutations (x :: l)) j hj✝
hi : i < length l + 1
hj : j < length l + 1
⊢ i = j

Next tactic:
rw [← mod_eq_of_lt hi, ← mod_eq_of_lt hj]
set_option linter.deprecated false in
/-- If a `l : List α` is `Nodup l`, then all of its cyclic permutants are distinct. -/
theorem Nodup.cyclicPermutations {l : List α} (hn : Nodup l) : Nodup (cyclicPermutations l) := by
  cases' l with x l
  · simp
  rw [nodup_iff_nthLe_inj]
  intro i j hi hj h
  simp only [length_cyclicPermutations_cons] at hi hj
  rw [← mod_eq_of_lt hi, ← mod_eq_of_lt hj]
  

Proof state:
case cons
α : Type u
l✝ l' : List α
x : α
l : List α
hn : Nodup (x :: l)
i j : ℕ
hi✝ : i < length (List.cyclicPermutations (x :: l))
hj✝ : j < length (List.cyclicPermutations (x :: l))
h : nthLe (List.cyclicPermutations (x :: l)) i hi✝ = nthLe (List.cyclicPermutations (x :: l)) j hj✝
hi : i < length l + 1
hj : j < length l + 1
⊢ i % (length l + 1) = j % (length l + 1)

Next tactic:
apply hn.rotate_congr
set_option linter.deprecated false in
/-- If a `l : List α` is `Nodup l`, then all of its cyclic permutants are distinct. -/
theorem Nodup.cyclicPermutations {l : List α} (hn : Nodup l) : Nodup (cyclicPermutations l) := by
  cases' l with x l
  · simp
  rw [nodup_iff_nthLe_inj]
  intro i j hi hj h
  simp only [length_cyclicPermutations_cons] at hi hj
  rw [← mod_eq_of_lt hi, ← mod_eq_of_lt hj]
  apply hn.rotate_congr
  · 

Proof state:
case cons.hn
α : Type u
l✝ l' : List α
x : α
l : List α
hn : Nodup (x :: l)
i j : ℕ
hi✝ : i < length (List.cyclicPermutations (x :: l))
hj✝ : j < length (List.cyclicPermutations (x :: l))
h : nthLe (List.cyclicPermutations (x :: l)) i hi✝ = nthLe (List.cyclicPermutations (x :: l)) j hj✝
hi : i < length l + 1
hj : j < length l + 1
⊢ x :: l ≠ []

Next tactic:
simp