File: Mathlib/Data/List/DropRight.lean

full_name: List.rdrop
code: /-- Drop `n` elements from the tail end of a list. -/
def rdrop : List α 
goal: List α

full_name: List.rdrop_nil
code: @[simp]
theorem rdrop_nil : rdrop ([] : List α) n = [] 
goal: [].rdrop n = []

full_name: List.rdrop_zero
code: @[simp]
theorem rdrop_zero : rdrop l 0 = l 
goal: l.rdrop 0 = l

full_name: List.rdrop_eq_reverse_drop_reverse
code: theorem rdrop_eq_reverse_drop_reverse : l.rdrop n = reverse (l.reverse.drop n) 
goal: l.rdrop n = (List.drop n l.reverse).reverse

full_name: List.rdrop_concat_succ
code: @[simp]
theorem rdrop_concat_succ (x : α) : rdrop (l ++ [x]) (n + 1) = rdrop l n 
goal: (l ++ [x]).rdrop (n + 1) = l.rdrop n

full_name: List.rtake
code: /-- Take `n` elements from the tail end of a list. -/
def rtake : List α 
goal: List α

full_name: List.rtake_nil
code: @[simp]
theorem rtake_nil : rtake ([] : List α) n = [] 
goal: [].rtake n = []

full_name: List.rtake_zero
code: @[simp]
theorem rtake_zero : rtake l 0 = [] 
goal: l.rtake 0 = []

full_name: List.rtake_eq_reverse_take_reverse
code: theorem rtake_eq_reverse_take_reverse : l.rtake n = reverse (l.reverse.take n) 
goal: l.rtake n = (List.take n l.reverse).reverse

full_name: List.rtake_concat_succ
code: @[simp]
theorem rtake_concat_succ (x : α) : rtake (l ++ [x]) (n + 1) = rtake l n ++ [x] 
goal: (l ++ [x]).rtake (n + 1) = l.rtake n ++ [x]

full_name: List.rdropWhile
code: /-- Drop elements from the tail end of a list that satisfy `p : α → Bool`.
Implemented naively via `List.reverse` -/
def rdropWhile : List α 
goal: List α

full_name: List.rdropWhile_nil
code: @[simp]
theorem rdropWhile_nil : rdropWhile p ([] : List α) = [] 
goal: List.rdropWhile p [] = []

full_name: List.rdropWhile_concat
code: theorem rdropWhile_concat (x : α) :
    rdropWhile p (l ++ [x]) = if p x then rdropWhile p l else l ++ [x] 
goal: List.rdropWhile p (l ++ [x]) = if p x = true then List.rdropWhile p l else l ++ [x]

full_name: List.rdropWhile_concat_pos
code: @[simp]
theorem rdropWhile_concat_pos (x : α) (h : p x) : rdropWhile p (l ++ [x]) = rdropWhile p l 
goal: List.rdropWhile p (l ++ [x]) = List.rdropWhile p l

full_name: List.rdropWhile_concat_neg
code: @[simp]
theorem rdropWhile_concat_neg (x : α) (h : ¬p x) : rdropWhile p (l ++ [x]) = l ++ [x] 
goal: List.rdropWhile p (l ++ [x]) = l ++ [x]

full_name: List.rdropWhile_singleton
code: theorem rdropWhile_singleton (x : α) : rdropWhile p [x] = if p x then [] else [x] 
goal: List.rdropWhile p [x] = if p x = true then [] else [x]

full_name: List.rdropWhile_last_not
code: theorem rdropWhile_last_not (hl : l.rdropWhile p ≠ []) : ¬p ((rdropWhile p l).getLast hl) 
goal: ¬p ((List.rdropWhile p l).getLast hl) = true

full_name: List.rdropWhile_prefix
code: theorem rdropWhile_prefix : l.rdropWhile p <+: l 
goal: List.rdropWhile p l <+: l

full_name: List.rdropWhile_eq_nil_iff
code: @[simp]
theorem rdropWhile_eq_nil_iff : rdropWhile p l = [] ↔ ∀ x ∈ l, p x 
goal: List.rdropWhile p l = [] ↔ ∀ (x : α), x ∈ l → p x = true

full_name: List.dropWhile_eq_self_iff
code: @[simp]
theorem dropWhile_eq_self_iff : dropWhile p l = l ↔ ∀ hl : 0 < l.length, ¬p (l.get ⟨0, hl⟩) 
goal: List.dropWhile p l = l ↔ ∀ (hl : 0 < l.length), ¬p (l.get ⟨0, hl⟩) = true

full_name: List.rdropWhile_eq_self_iff
code: @[simp]
theorem rdropWhile_eq_self_iff : rdropWhile p l = l ↔ ∀ hl : l ≠ [], ¬p (l.getLast hl) 
goal: List.rdropWhile p l = l ↔ ∀ (hl : l ≠ []), ¬p (l.getLast hl) = true

full_name: List.dropWhile_idempotent
code: theorem dropWhile_idempotent : dropWhile p (dropWhile p l) = dropWhile p l 
goal: List.dropWhile p (List.dropWhile p l) = List.dropWhile p l

full_name: List.rdropWhile_idempotent
code: theorem rdropWhile_idempotent : rdropWhile p (rdropWhile p l) = rdropWhile p l 
goal: List.rdropWhile p (List.rdropWhile p l) = List.rdropWhile p l

full_name: List.rtakeWhile
code: /-- Take elements from the tail end of a list that satisfy `p : α → Bool`.
Implemented naively via `List.reverse` -/
def rtakeWhile : List α 
goal: List α

full_name: List.rtakeWhile_nil
code: @[simp]
theorem rtakeWhile_nil : rtakeWhile p ([] : List α) = [] 
goal: List.rtakeWhile p [] = []

full_name: List.rtakeWhile_concat
code: theorem rtakeWhile_concat (x : α) :
    rtakeWhile p (l ++ [x]) = if p x then rtakeWhile p l ++ [x] else [] 
goal: List.rtakeWhile p (l ++ [x]) = if p x = true then List.rtakeWhile p l ++ [x] else []

full_name: List.rtakeWhile_concat_pos
code: @[simp]
theorem rtakeWhile_concat_pos (x : α) (h : p x) :
    rtakeWhile p (l ++ [x]) = rtakeWhile p l ++ [x] 
goal: List.rtakeWhile p (l ++ [x]) = List.rtakeWhile p l ++ [x]

full_name: List.rtakeWhile_concat_neg
code: @[simp]
theorem rtakeWhile_concat_neg (x : α) (h : ¬p x) : rtakeWhile p (l ++ [x]) = [] 
goal: List.rtakeWhile p (l ++ [x]) = []

full_name: List.rtakeWhile_suffix
code: theorem rtakeWhile_suffix : l.rtakeWhile p <:+ l 
goal: List.rtakeWhile p l <:+ l

full_name: List.rtakeWhile_eq_self_iff
code: @[simp]
theorem rtakeWhile_eq_self_iff : rtakeWhile p l = l ↔ ∀ x ∈ l, p x 
goal: List.rtakeWhile p l = l ↔ ∀ (x : α), x ∈ l → p x = true

full_name: List.rtakeWhile_eq_nil_iff
code: @[simp]
theorem rtakeWhile_eq_nil_iff : rtakeWhile p l = [] ↔ ∀ hl : l ≠ [], ¬p (l.getLast hl) 
goal: List.rtakeWhile p l = [] ↔ ∀ (hl : l ≠ []), ¬p (l.getLast hl) = true

full_name: List.mem_rtakeWhile_imp
code: theorem mem_rtakeWhile_imp {x : α} (hx : x ∈ rtakeWhile p l) : p x 
goal: p x = true

full_name: List.rtakeWhile_idempotent
code: theorem rtakeWhile_idempotent (p : α → Bool) (l : List α) :
    rtakeWhile p (rtakeWhile p l) = rtakeWhile p l 
goal: List.rtakeWhile p (List.rtakeWhile p l) = List.rtakeWhile p l

full_name: List.rdrop_add
code: lemma rdrop_add (i j : ℕ) : (l.rdrop i).rdrop j = l.rdrop (i + j) 
goal: (l.rdrop i).rdrop j = l.rdrop (i + j)

full_name: List.rdrop_append_length
code: @[simp]
lemma rdrop_append_length {l₁ l₂ : List α} :
    List.rdrop (l₁ ++ l₂) (List.length l₂) = l₁ 
goal: (l₁ ++ l₂).rdrop l₂.length = l₁

full_name: List.rdrop_append_of_le_length
code: lemma rdrop_append_of_le_length {l₁ l₂ : List α} (k : ℕ) :
    k ≤ length l₂ → List.rdrop (l₁ ++ l₂) k = l₁ ++ List.rdrop l₂ k 
goal: k ≤ l₂.length → (l₁ ++ l₂).rdrop k = l₁ ++ l₂.rdrop k

full_name: List.rdrop_append_length_add
code: @[simp]
lemma rdrop_append_length_add {l₁ l₂ : List α} (k : ℕ) :
    List.rdrop (l₁ ++ l₂) (length l₂ + k) = List.rdrop l₁ k 
goal: (l₁ ++ l₂).rdrop (l₂.length + k) = l₁.rdrop k