File: Mathlib/Data/List/Cycle.lean

full_name: List.nextOr
code: /-- Return the `z` such that `x :: z :: _` appears in `xs`, or `default` if there is no such `z`. -/
def nextOr : ∀ (_ : List α) (_ _ : α), α
  
goal: List α → α → α → α

full_name: List.nextOr_nil
code: @[simp]
theorem nextOr_nil (x d : α) : nextOr [] x d = d 
goal: [].nextOr x d = d

full_name: List.nextOr_singleton
code: @[simp]
theorem nextOr_singleton (x y d : α) : nextOr [y] x d = d 
goal: [y].nextOr x d = d

full_name: List.nextOr_self_cons_cons
code: @[simp]
theorem nextOr_self_cons_cons (xs : List α) (x y d : α) : nextOr (x :: y :: xs) x d = y 
goal: (x :: y :: xs).nextOr x d = y

full_name: List.nextOr_cons_of_ne
code: theorem nextOr_cons_of_ne (xs : List α) (y x d : α) (h : x ≠ y) :
    nextOr (y :: xs) x d = nextOr xs x d 
goal: (y :: xs).nextOr x d = xs.nextOr x d

full_name: List.nextOr_eq_nextOr_of_mem_of_ne
code: /-- `nextOr` does not depend on the default value, if the next value appears. -/
theorem nextOr_eq_nextOr_of_mem_of_ne (xs : List α) (x d d' : α) (x_mem : x ∈ xs)
    (x_ne : x ≠ xs.getLast (ne_nil_of_mem x_mem)) : nextOr xs x d = nextOr xs x d' 
goal: xs.nextOr x d = xs.nextOr x d'

full_name: List.mem_of_nextOr_ne
code: theorem mem_of_nextOr_ne {xs : List α} {x d : α} (h : nextOr xs x d ≠ d) : x ∈ xs 
goal: x ∈ xs

full_name: List.nextOr_concat
code: theorem nextOr_concat {xs : List α} {x : α} (d : α) (h : x ∉ xs) : nextOr (xs ++ [x]) x d = d 
goal: (xs ++ [x]).nextOr x d = d

full_name: List.nextOr_mem
code: theorem nextOr_mem {xs : List α} {x d : α} (hd : d ∈ xs) : nextOr xs x d ∈ xs 
goal: xs.nextOr x d ∈ xs

full_name: List.next
code: /-- Given an element `x : α` of `l : List α` such that `x ∈ l`, get the next
element of `l`. This works from head to tail, (including a check for last element)
so it will match on first hit, ignoring later duplicates.

For example:
 * `next [1, 2, 3] 2 _ = 3`
 * `next [1, 2, 3] 3 _ = 1`
 * `next [1, 2, 3, 2, 4] 2 _ = 3`
 * `next [1, 2, 3, 2] 2 _ = 3`
 * `next [1, 1, 2, 3, 2] 1 _ = 1`
-/
def next (l : List α) (x : α) (h : x ∈ l) : α 
goal: α

full_name: List.prev
code: /-- Given an element `x : α` of `l : List α` such that `x ∈ l`, get the previous
element of `l`. This works from head to tail, (including a check for last element)
so it will match on first hit, ignoring later duplicates.

 * `prev [1, 2, 3] 2 _ = 1`
 * `prev [1, 2, 3] 1 _ = 3`
 * `prev [1, 2, 3, 2, 4] 2 _ = 1`
 * `prev [1, 2, 3, 4, 2] 2 _ = 1`
 * `prev [1, 1, 2] 1 _ = 2`
-/
def prev : ∀ l : List α, ∀ x ∈ l, α
  
goal: x ∈ l → α

full_name: List.next_singleton
code: @[simp]
theorem next_singleton (x y : α) (h : x ∈ [y]) : next [y] x h = y 
goal: [y].next x h = y

full_name: List.prev_singleton
code: @[simp]
theorem prev_singleton (x y : α) (h : x ∈ [y]) : prev [y] x h = y 
goal: [y].prev x h = y

full_name: List.next_cons_cons_eq'
code: theorem next_cons_cons_eq' (y z : α) (h : x ∈ y :: z :: l) (hx : x = y) :
    next (y :: z :: l) x h = z 
goal: (y :: z :: l).next x h = z

full_name: List.next_cons_cons_eq
code: @[simp]
theorem next_cons_cons_eq (z : α) (h : x ∈ x :: z :: l) : next (x :: z :: l) x h = z 
goal: (x :: z :: l).next x h = z

full_name: List.next_ne_head_ne_getLast
code: theorem next_ne_head_ne_getLast (h : x ∈ l) (y : α) (h : x ∈ y :: l) (hy : x ≠ y)
    (hx : x ≠ getLast (y :: l) (cons_ne_nil _ _)) :
    next (y :: l) x h = next l x (by simpa [hy] using h) 
goal: ∀ (h : x ∈ y :: l) (hy : x ≠ y), x ≠ (y :: l).getLast ⋯ → (y :: l).next x h = l.next x ⋯

full_name: List.next_cons_concat
code: theorem next_cons_concat (y : α) (hy : x ≠ y) (hx : x ∉ l)
    (h : x ∈ y :: l ++ [x] := mem_append_right _ (mem_singleton_self x)) :
    next (y :: l ++ [x]) x h = y 
goal: (y :: l ++ [x]).next x h = y

full_name: List.next_getLast_cons
code: theorem next_getLast_cons (h : x ∈ l) (y : α) (h : x ∈ y :: l) (hy : x ≠ y)
    (hx : x = getLast (y :: l) (cons_ne_nil _ _)) (hl : Nodup l) : next (y :: l) x h = y 
goal: ∀ (h : x ∈ y :: l), x ≠ y → x = (y :: l).getLast ⋯ → l.Nodup → (y :: l).next x h = y

full_name: List.prev_getLast_cons'
code: theorem prev_getLast_cons' (y : α) (hxy : x ∈ y :: l) (hx : x = y) :
    prev (y :: l) x hxy = getLast (y :: l) (cons_ne_nil _ _) 
goal: (y :: l).prev x hxy = (y :: l).getLast ⋯

full_name: List.prev_getLast_cons
code: @[simp]
theorem prev_getLast_cons (h : x ∈ x :: l) :
    prev (x :: l) x h = getLast (x :: l) (cons_ne_nil _ _) 
goal: (x :: l).prev x h = (x :: l).getLast ⋯

full_name: List.prev_cons_cons_eq'
code: theorem prev_cons_cons_eq' (y z : α) (h : x ∈ y :: z :: l) (hx : x = y) :
    prev (y :: z :: l) x h = getLast (z :: l) (cons_ne_nil _ _) 
goal: (y :: z :: l).prev x h = (z :: l).getLast ⋯

full_name: List.prev_cons_cons_eq
code: theorem prev_cons_cons_eq (z : α) (h : x ∈ x :: z :: l) :
    prev (x :: z :: l) x h = getLast (z :: l) (cons_ne_nil _ _) 
goal: (x :: z :: l).prev x h = (z :: l).getLast ⋯

full_name: List.prev_cons_cons_of_ne'
code: theorem prev_cons_cons_of_ne' (y z : α) (h : x ∈ y :: z :: l) (hy : x ≠ y) (hz : x = z) :
    prev (y :: z :: l) x h = y 
goal: (y :: z :: l).prev x h = y

full_name: List.prev_cons_cons_of_ne
code: theorem prev_cons_cons_of_ne (y : α) (h : x ∈ y :: x :: l) (hy : x ≠ y) :
    prev (y :: x :: l) x h = y 
goal: (y :: x :: l).prev x h = y

full_name: List.prev_ne_cons_cons
code: theorem prev_ne_cons_cons (y z : α) (h : x ∈ y :: z :: l) (hy : x ≠ y) (hz : x ≠ z) :
    prev (y :: z :: l) x h = prev (z :: l) x (by simpa [hy] using h) 
goal: (y :: z :: l).prev x h = (z :: l).prev x ⋯

full_name: List.next_mem
code: theorem next_mem (h : x ∈ l) : l.next x h ∈ l 
goal: l.next x h ∈ l

full_name: List.prev_mem
code: theorem prev_mem (h : x ∈ l) : l.prev x h ∈ l 
goal: l.prev x h ∈ l

full_name: List.next_get
code: theorem next_get : ∀ (l : List α) (_h : Nodup l) (i : Fin l.length),
    next l (l.get i) (get_mem _ _ _) = l.get ⟨(i + 1) % l.length,
      Nat.mod_lt _ (i.1.zero_le.trans_lt i.2)⟩
  
goal: l.next (l.get i) ⋯ = l.get ⟨(↑i + 1) % l.length, ⋯⟩

full_name: List.next_nthLe
code: @[deprecated next_get (since := "2023-01-27")]
theorem next_nthLe (l : List α) (h : Nodup l) (n : ℕ) (hn : n < l.length) :
    next l (l.nthLe n hn) (nthLe_mem _ _ _) =
      l.nthLe ((n + 1) % l.length) (Nat.mod_lt _ (n.zero_le.trans_lt hn)) 
goal: l.next (l.nthLe n hn) ⋯ = l.nthLe ((n + 1) % l.length) ⋯

full_name: List.prev_nthLe
code: 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)) 
goal: l.prev (l.nthLe n hn) ⋯ = l.nthLe ((n + (l.length - 1)) % l.length) ⋯

full_name: List.pmap_next_eq_rotate_one
code: theorem pmap_next_eq_rotate_one (h : Nodup l) : (l.pmap l.next fun _ h => h) = l.rotate 1 
goal: List.pmap l.next l ⋯ = l.rotate 1

full_name: List.pmap_prev_eq_rotate_length_sub_one
code: theorem pmap_prev_eq_rotate_length_sub_one (h : Nodup l) :
    (l.pmap l.prev fun _ h => h) = l.rotate (l.length - 1) 
goal: List.pmap l.prev l ⋯ = l.rotate (l.length - 1)

full_name: List.prev_next
code: theorem prev_next (l : List α) (h : Nodup l) (x : α) (hx : x ∈ l) :
    prev l (next l x hx) (next_mem _ _ _) = x 
goal: l.prev (l.next x hx) ⋯ = x

full_name: List.next_prev
code: theorem next_prev (l : List α) (h : Nodup l) (x : α) (hx : x ∈ l) :
    next l (prev l x hx) (prev_mem _ _ _) = x 
goal: l.next (l.prev x hx) ⋯ = x

full_name: List.prev_reverse_eq_next
code: theorem prev_reverse_eq_next (l : List α) (h : Nodup l) (x : α) (hx : x ∈ l) :
    prev l.reverse x (mem_reverse.mpr hx) = next l x hx 
goal: l.reverse.prev x ⋯ = l.next x hx

full_name: List.next_reverse_eq_prev
code: theorem next_reverse_eq_prev (l : List α) (h : Nodup l) (x : α) (hx : x ∈ l) :
    next l.reverse x (mem_reverse.mpr hx) = prev l x hx 
goal: l.reverse.next x ⋯ = l.prev x hx

full_name: List.isRotated_next_eq
code: theorem isRotated_next_eq {l l' : List α} (h : l ~r l') (hn : Nodup l) {x : α} (hx : x ∈ l) :
    l.next x hx = l'.next x (h.mem_iff.mp hx) 
goal: l.next x hx = l'.next x ⋯

full_name: List.isRotated_prev_eq
code: theorem isRotated_prev_eq {l l' : List α} (h : l ~r l') (hn : Nodup l) {x : α} (hx : x ∈ l) :
    l.prev x hx = l'.prev x (h.mem_iff.mp hx) 
goal: l.prev x hx = l'.prev x ⋯

full_name: Cycle
code: /-- `Cycle α` is the quotient of `List α` by cyclic permutation.
Duplicates are allowed.
-/
def Cycle (α : Type*) : Type _ 
goal: Type u_1

full_name: Cycle.ofList
code: /-- The coercion from `List α` to `Cycle α` -/
@[coe] def ofList : List α → Cycle α 
goal: List α → Cycle α

full_name: Cycle.instCoeList
code: instance : Coe (List α) (Cycle α) 
goal: Coe (List α) (Cycle α)

full_name: Cycle.coe_eq_coe
code: @[simp]
theorem coe_eq_coe {l₁ l₂ : List α} : (l₁ : Cycle α) = (l₂ : Cycle α) ↔ l₁ ~r l₂ 
goal: ↑l₁ = ↑l₂ ↔ l₁ ~r l₂

full_name: Cycle.mk_eq_coe
code: @[simp]
theorem mk_eq_coe (l : List α) : Quot.mk _ l = (l : Cycle α) 
goal: Quot.mk Setoid.r l = ↑l

full_name: Cycle.mk''_eq_coe
code: @[simp]
theorem mk''_eq_coe (l : List α) : Quotient.mk'' l = (l : Cycle α) 
goal: Quotient.mk'' l = ↑l

full_name: Cycle.coe_cons_eq_coe_append
code: theorem coe_cons_eq_coe_append (l : List α) (a : α) :
    (↑(a :: l) : Cycle α) = (↑(l ++ [a]) : Cycle α) 
goal: ↑(a :: l) = ↑(l ++ [a])

full_name: Cycle.nil
code: /-- The unique empty cycle. -/
def nil : Cycle α 
goal: Cycle α

full_name: Cycle.coe_nil
code: @[simp]
theorem coe_nil : ↑([] : List α) = @nil α 
goal: ↑[] = Cycle.nil

full_name: Cycle.coe_eq_nil
code: @[simp]
theorem coe_eq_nil (l : List α) : (l : Cycle α) = nil ↔ l = [] 
goal: ↑l = Cycle.nil ↔ l = []

full_name: Cycle.instEmptyCollection
code: /-- For consistency with `EmptyCollection (List α)`. -/
instance : EmptyCollection (Cycle α) 
goal: EmptyCollection (Cycle α)

full_name: Cycle.empty_eq
code: @[simp]
theorem empty_eq : ∅ = @nil α 
goal: ∅ = Cycle.nil

full_name: Cycle.instInhabited
code: instance : Inhabited (Cycle α) 
goal: Inhabited (Cycle α)

full_name: Cycle.induction_on
code: /-- An induction principle for `Cycle`. Use as `induction s`. -/
@[elab_as_elim, induction_eliminator]
theorem induction_on {C : Cycle α → Prop} (s : Cycle α) (H0 : C nil)
    (HI : ∀ (a) (l : List α), C ↑l → C ↑(a :: l)) : C s 
goal: C s

full_name: Cycle.Mem
code: /-- For `x : α`, `s : Cycle α`, `x ∈ s` indicates that `x` occurs at least once in `s`. -/
def Mem (a : α) (s : Cycle α) : Prop 
goal: Prop

full_name: Cycle.instMembership
code: instance : Membership α (Cycle α) 
goal: Membership α (Cycle α)

full_name: Cycle.mem_coe_iff
code: @[simp]
theorem mem_coe_iff {a : α} {l : List α} : a ∈ (↑l : Cycle α) ↔ a ∈ l 
goal: a ∈ ↑l ↔ a ∈ l

full_name: Cycle.not_mem_nil
code: @[simp]
theorem not_mem_nil : ∀ a, a ∉ @nil α 
goal: a ∉ Cycle.nil

full_name: Cycle.instDecidableEq
code: instance [DecidableEq α] : DecidableEq (Cycle α) 
goal: DecidableEq (Cycle α)

full_name: Cycle.instDecidableMemOfDecidableEq
code: instance [DecidableEq α] (x : α) (s : Cycle α) : Decidable (x ∈ s) 
goal: Decidable (x ∈ s)

full_name: Cycle.reverse
code: /-- Reverse a `s : Cycle α` by reversing the underlying `List`. -/
nonrec def reverse (s : Cycle α) : Cycle α 
goal: Cycle α

full_name: Cycle.reverse_coe
code: @[simp]
theorem reverse_coe (l : List α) : (l : Cycle α).reverse = l.reverse 
goal: (↑l).reverse = ↑l.reverse

full_name: Cycle.mem_reverse_iff
code: @[simp]
theorem mem_reverse_iff {a : α} {s : Cycle α} : a ∈ s.reverse ↔ a ∈ s 
goal: a ∈ s.reverse ↔ a ∈ s

full_name: Cycle.reverse_reverse
code: @[simp]
theorem reverse_reverse (s : Cycle α) : s.reverse.reverse = s 
goal: s.reverse.reverse = s

full_name: Cycle.reverse_nil
code: @[simp]
theorem reverse_nil : nil.reverse = @nil α 
goal: Cycle.nil.reverse = Cycle.nil

full_name: Cycle.length
code: /-- The length of the `s : Cycle α`, which is the number of elements, counting duplicates. -/
def length (s : Cycle α) : ℕ 
goal: ℕ

full_name: Cycle.length_coe
code: @[simp]
theorem length_coe (l : List α) : length (l : Cycle α) = l.length 
goal: (↑l).length = l.length

full_name: Cycle.length_nil
code: @[simp]
theorem length_nil : length (@nil α) = 0 
goal: Cycle.nil.length = 0

full_name: Cycle.length_reverse
code: @[simp]
theorem length_reverse (s : Cycle α) : s.reverse.length = s.length 
goal: s.reverse.length = s.length

full_name: Cycle.Subsingleton
code: /-- A `s : Cycle α` that is at most one element. -/
def Subsingleton (s : Cycle α) : Prop 
goal: Prop

full_name: Cycle.subsingleton_nil
code: theorem subsingleton_nil : Subsingleton (@nil α) 
goal: Cycle.nil.Subsingleton

full_name: Cycle.length_subsingleton_iff
code: theorem length_subsingleton_iff {s : Cycle α} : Subsingleton s ↔ length s ≤ 1 
goal: s.Subsingleton ↔ s.length ≤ 1

full_name: Cycle.subsingleton_reverse_iff
code: @[simp]
theorem subsingleton_reverse_iff {s : Cycle α} : s.reverse.Subsingleton ↔ s.Subsingleton 
goal: s.reverse.Subsingleton ↔ s.Subsingleton

full_name: Cycle.Subsingleton.congr
code: theorem Subsingleton.congr {s : Cycle α} (h : Subsingleton s) :
    ∀ ⦃x⦄ (_hx : x ∈ s) ⦃y⦄ (_hy : y ∈ s), x = y 
goal: x = y

full_name: Cycle.Nontrivial
code: /-- A `s : Cycle α` that is made up of at least two unique elements. -/
def Nontrivial (s : Cycle α) : Prop 
goal: Prop

full_name: Cycle.nontrivial_coe_nodup_iff
code: @[simp]
theorem nontrivial_coe_nodup_iff {l : List α} (hl : l.Nodup) :
    Nontrivial (l : Cycle α) ↔ 2 ≤ l.length 
goal: (↑l).Nontrivial ↔ 2 ≤ l.length

full_name: Cycle.nontrivial_reverse_iff
code: @[simp]
theorem nontrivial_reverse_iff {s : Cycle α} : s.reverse.Nontrivial ↔ s.Nontrivial 
goal: s.reverse.Nontrivial ↔ s.Nontrivial

full_name: Cycle.length_nontrivial
code: theorem length_nontrivial {s : Cycle α} (h : Nontrivial s) : 2 ≤ length s 
goal: 2 ≤ s.length

full_name: Cycle.Nodup
code: /-- The `s : Cycle α` contains no duplicates. -/
nonrec def Nodup (s : Cycle α) : Prop 
goal: Prop

full_name: Cycle.nodup_nil
code: @[simp]
nonrec theorem nodup_nil : Nodup (@nil α) 
goal: Cycle.nil.Nodup

full_name: Cycle.nodup_coe_iff
code: @[simp]
theorem nodup_coe_iff {l : List α} : Nodup (l : Cycle α) ↔ l.Nodup 
goal: (↑l).Nodup ↔ l.Nodup

full_name: Cycle.nodup_reverse_iff
code: @[simp]
theorem nodup_reverse_iff {s : Cycle α} : s.reverse.Nodup ↔ s.Nodup 
goal: s.reverse.Nodup ↔ s.Nodup

full_name: Cycle.Subsingleton.nodup
code: theorem Subsingleton.nodup {s : Cycle α} (h : Subsingleton s) : Nodup s 
goal: s.Nodup

full_name: Cycle.Nodup.nontrivial_iff
code: theorem Nodup.nontrivial_iff {s : Cycle α} (h : Nodup s) : Nontrivial s ↔ ¬Subsingleton s 
goal: s.Nontrivial ↔ ¬s.Subsingleton

full_name: Cycle.toMultiset
code: /-- The `s : Cycle α` as a `Multiset α`.
-/
def toMultiset (s : Cycle α) : Multiset α 
goal: Multiset α

full_name: Cycle.coe_toMultiset
code: @[simp]
theorem coe_toMultiset (l : List α) : (l : Cycle α).toMultiset = l 
goal: (↑l).toMultiset = ↑l

full_name: Cycle.nil_toMultiset
code: @[simp]
theorem nil_toMultiset : nil.toMultiset = (0 : Multiset α) 
goal: Cycle.nil.toMultiset = 0

full_name: Cycle.card_toMultiset
code: @[simp]
theorem card_toMultiset (s : Cycle α) : Multiset.card s.toMultiset = s.length 
goal: Multiset.card s.toMultiset = s.length

full_name: Cycle.toMultiset_eq_nil
code: @[simp]
theorem toMultiset_eq_nil {s : Cycle α} : s.toMultiset = 0 ↔ s = Cycle.nil 
goal: s.toMultiset = 0 ↔ s = Cycle.nil

full_name: Cycle.map
code: /-- The lift of `list.map`. -/
def map {β : Type*} (f : α → β) : Cycle α → Cycle β 
goal: Cycle α → Cycle β

full_name: Cycle.map_nil
code: @[simp]
theorem map_nil {β : Type*} (f : α → β) : map f nil = nil 
goal: Cycle.map f Cycle.nil = Cycle.nil

full_name: Cycle.map_coe
code: @[simp]
theorem map_coe {β : Type*} (f : α → β) (l : List α) : map f ↑l = List.map f l 
goal: Cycle.map f ↑l = ↑(List.map f l)

full_name: Cycle.map_eq_nil
code: @[simp]
theorem map_eq_nil {β : Type*} (f : α → β) (s : Cycle α) : map f s = nil ↔ s = nil 
goal: Cycle.map f s = Cycle.nil ↔ s = Cycle.nil

full_name: Cycle.mem_map
code: @[simp]
theorem mem_map {β : Type*} {f : α → β} {b : β} {s : Cycle α} :
    b ∈ s.map f ↔ ∃ a, a ∈ s ∧ f a = b 
goal: b ∈ Cycle.map f s ↔ ∃ a ∈ s, f a = b

full_name: Cycle.lists
code: /-- The `Multiset` of lists that can make the cycle. -/
def lists (s : Cycle α) : Multiset (List α) 
goal: Multiset (List α)

full_name: Cycle.lists_coe
code: @[simp]
theorem lists_coe (l : List α) : lists (l : Cycle α) = ↑l.cyclicPermutations 
goal: (↑l).lists = ↑l.cyclicPermutations

full_name: Cycle.mem_lists_iff_coe_eq
code: @[simp]
theorem mem_lists_iff_coe_eq {s : Cycle α} {l : List α} : l ∈ s.lists ↔ (l : Cycle α) = s 
goal: l ∈ s.lists ↔ ↑l = s

full_name: Cycle.lists_nil
code: @[simp]
theorem lists_nil : lists (@nil α) = [([] : List α)] 
goal: Cycle.nil.lists = ↑[[]]

full_name: Cycle.decidableNontrivialCoe
code: /-- Auxiliary decidability algorithm for lists that contain at least two unique elements.
-/
def decidableNontrivialCoe : ∀ l : List α, Decidable (Nontrivial (l : Cycle α))
  
goal: Decidable (↑l).Nontrivial

full_name: Cycle.instDecidableNontrivial
code: instance {s : Cycle α} : Decidable (Nontrivial s) 
goal: Decidable s.Nontrivial

full_name: Cycle.instDecidableNodup
code: instance {s : Cycle α} : Decidable (Nodup s) 
goal: Decidable s.Nodup

full_name: Cycle.fintypeNodupCycle
code: instance fintypeNodupCycle [Fintype α] : Fintype { s : Cycle α // s.Nodup } 
goal: Fintype { s // s.Nodup }

full_name: Cycle.fintypeNodupNontrivialCycle
code: instance fintypeNodupNontrivialCycle [Fintype α] :
    Fintype { s : Cycle α // s.Nodup ∧ s.Nontrivial } 
goal: Fintype { s // s.Nodup ∧ s.Nontrivial }

full_name: Cycle.toFinset
code: /-- The `s : Cycle α` as a `Finset α`. -/
def toFinset (s : Cycle α) : Finset α 
goal: Finset α

full_name: Cycle.toFinset_toMultiset
code: @[simp]
theorem toFinset_toMultiset (s : Cycle α) : s.toMultiset.toFinset = s.toFinset 
goal: s.toMultiset.toFinset = s.toFinset

full_name: Cycle.coe_toFinset
code: @[simp]
theorem coe_toFinset (l : List α) : (l : Cycle α).toFinset = l.toFinset 
goal: (↑l).toFinset = l.toFinset

full_name: Cycle.nil_toFinset
code: @[simp]
theorem nil_toFinset : (@nil α).toFinset = ∅ 
goal: Cycle.nil.toFinset = ∅

full_name: Cycle.toFinset_eq_nil
code: @[simp]
theorem toFinset_eq_nil {s : Cycle α} : s.toFinset = ∅ ↔ s = Cycle.nil 
goal: s.toFinset = ∅ ↔ s = Cycle.nil

full_name: Cycle.next
code: /-- Given a `s : Cycle α` such that `Nodup s`, retrieve the next element after `x ∈ s`. -/
nonrec def next : ∀ (s : Cycle α) (_hs : Nodup s) (x : α) (_hx : x ∈ s), α 
goal: α

full_name: Cycle.prev
code: /-- Given a `s : Cycle α` such that `Nodup s`, retrieve the previous element before `x ∈ s`. -/
nonrec def prev : ∀ (s : Cycle α) (_hs : Nodup s) (x : α) (_hx : x ∈ s), α 
goal: α

full_name: Cycle.prev_reverse_eq_next
code: nonrec theorem prev_reverse_eq_next (s : Cycle α) : ∀ (hs : Nodup s) (x : α) (hx : x ∈ s),
    s.reverse.prev (nodup_reverse_iff.mpr hs) x (mem_reverse_iff.mpr hx) = s.next hs x hx 
goal: s.reverse.prev ⋯ x ⋯ = s.next hs x hx

full_name: Cycle.prev_reverse_eq_next'
code: @[simp]
nonrec theorem prev_reverse_eq_next' (s : Cycle α) (hs : Nodup s.reverse) (x : α)
    (hx : x ∈ s.reverse) :
    s.reverse.prev hs x hx = s.next (nodup_reverse_iff.mp hs) x (mem_reverse_iff.mp hx) 
goal: s.reverse.prev hs x hx = s.next ⋯ x ⋯

full_name: Cycle.next_reverse_eq_prev
code: theorem next_reverse_eq_prev (s : Cycle α) (hs : Nodup s) (x : α) (hx : x ∈ s) :
    s.reverse.next (nodup_reverse_iff.mpr hs) x (mem_reverse_iff.mpr hx) = s.prev hs x hx 
goal: s.reverse.next ⋯ x ⋯ = s.prev hs x hx

full_name: Cycle.next_reverse_eq_prev'
code: @[simp]
theorem next_reverse_eq_prev' (s : Cycle α) (hs : Nodup s.reverse) (x : α) (hx : x ∈ s.reverse) :
    s.reverse.next hs x hx = s.prev (nodup_reverse_iff.mp hs) x (mem_reverse_iff.mp hx) 
goal: s.reverse.next hs x hx = s.prev ⋯ x ⋯

full_name: Cycle.next_mem
code: @[simp]
nonrec theorem next_mem (s : Cycle α) (hs : Nodup s) (x : α) (hx : x ∈ s) : s.next hs x hx ∈ s 
goal: s.next hs x hx ∈ s

full_name: Cycle.prev_mem
code: theorem prev_mem (s : Cycle α) (hs : Nodup s) (x : α) (hx : x ∈ s) : s.prev hs x hx ∈ s 
goal: s.prev hs x hx ∈ s

full_name: Cycle.prev_next
code: @[simp]
nonrec theorem prev_next (s : Cycle α) : ∀ (hs : Nodup s) (x : α) (hx : x ∈ s),
    s.prev hs (s.next hs x hx) (next_mem s hs x hx) = x 
goal: s.prev hs (s.next hs x hx) ⋯ = x

full_name: Cycle.next_prev
code: @[simp]
nonrec theorem next_prev (s : Cycle α) : ∀ (hs : Nodup s) (x : α) (hx : x ∈ s),
    s.next hs (s.prev hs x hx) (prev_mem s hs x hx) = x 
goal: s.next hs (s.prev hs x hx) ⋯ = x

full_name: Cycle.instRepr
code: /-- We define a representation of concrete cycles, available when viewing them in a goal state or
via `#eval`, when over representable types. For example, the cycle `(2 1 4 3)` will be shown
as `c[2, 1, 4, 3]`. Two equal cycles may be printed differently if their internal representation
is different.
-/
unsafe instance [Repr α] : Repr (Cycle α) 
goal: Repr (Cycle α)

full_name: Cycle.Chain
code: /-- `chain R s` means that `R` holds between adjacent elements of `s`.

`chain R ([a, b, c] : Cycle α) ↔ R a b ∧ R b c ∧ R c a` -/
nonrec def Chain (r : α → α → Prop) (c : Cycle α) : Prop 
goal: Prop

full_name: Cycle.Chain.nil
code: @[simp]
theorem Chain.nil (r : α → α → Prop) : Cycle.Chain r (@nil α) 
goal: Cycle.Chain r Cycle.nil

full_name: Cycle.chain_coe_cons
code: @[simp]
theorem chain_coe_cons (r : α → α → Prop) (a : α) (l : List α) :
    Chain r (a :: l) ↔ List.Chain r a (l ++ [a]) 
goal: Cycle.Chain r ↑(a :: l) ↔ List.Chain r a (l ++ [a])

full_name: Cycle.chain_singleton
code: theorem chain_singleton (r : α → α → Prop) (a : α) : Chain r [a] ↔ r a a 
goal: Cycle.Chain r ↑[a] ↔ r a a

full_name: Cycle.chain_ne_nil
code: theorem chain_ne_nil (r : α → α → Prop) {l : List α} :
    ∀ hl : l ≠ [], Chain r l ↔ List.Chain r (getLast l hl) l 
goal: Cycle.Chain r ↑l ↔ List.Chain r (l.getLast hl) l

full_name: Cycle.chain_map
code: theorem chain_map {β : Type*} {r : α → α → Prop} (f : β → α) {s : Cycle β} :
    Chain r (s.map f) ↔ Chain (fun a b => r (f a) (f b)) s 
goal: Cycle.Chain r (Cycle.map f s) ↔ Cycle.Chain (fun a b => r (f a) (f b)) s

full_name: Cycle.chain_range_succ
code: nonrec theorem chain_range_succ (r : ℕ → ℕ → Prop) (n : ℕ) :
    Chain r (List.range n.succ) ↔ r n 0 ∧ ∀ m < n, r m m.succ 
goal: Cycle.Chain r ↑(List.range n.succ) ↔ r n 0 ∧ ∀ m < n, r m m.succ

full_name: Cycle.Chain.imp
code: theorem Chain.imp {r₁ r₂ : α → α → Prop} (H : ∀ a b, r₁ a b → r₂ a b) (p : Chain r₁ s) :
    Chain r₂ s 
goal: Cycle.Chain r₂ s

full_name: Cycle.chain_mono
code: /-- As a function from a relation to a predicate, `chain` is monotonic. -/
theorem chain_mono : Monotone (Chain : (α → α → Prop) → Cycle α → Prop) 
goal: Monotone Cycle.Chain

full_name: Cycle.chain_of_pairwise
code: theorem chain_of_pairwise : (∀ a ∈ s, ∀ b ∈ s, r a b) → Chain r s 
goal: (∀ a ∈ s, ∀ b ∈ s, r a b) → Cycle.Chain r s

full_name: Cycle.chain_iff_pairwise
code: theorem chain_iff_pairwise [IsTrans α r] : Chain r s ↔ ∀ a ∈ s, ∀ b ∈ s, r a b 
goal: Cycle.Chain r s ↔ ∀ a ∈ s, ∀ b ∈ s, r a b

full_name: Cycle.Chain.eq_nil_of_irrefl
code: theorem Chain.eq_nil_of_irrefl [IsTrans α r] [IsIrrefl α r] (h : Chain r s) : s = Cycle.nil 
goal: s = Cycle.nil

full_name: Cycle.Chain.eq_nil_of_well_founded
code: theorem Chain.eq_nil_of_well_founded [IsWellFounded α r] (h : Chain r s) : s = Cycle.nil 
goal: s = Cycle.nil

full_name: Cycle.forall_eq_of_chain
code: theorem forall_eq_of_chain [IsTrans α r] [IsAntisymm α r] (hs : Chain r s) {a b : α} (ha : a ∈ s)
    (hb : b ∈ s) : a = b 
goal: a = b