File: Mathlib/Data/List/Sublists.lean

full_name: List.sublists'_nil
code: @[simp]
theorem sublists'_nil : sublists' (@nil α) = [[]] 
goal: [].sublists' = [[]]

full_name: List.sublists'_singleton
code: @[simp]
theorem sublists'_singleton (a : α) : sublists' [a] = [[], [a]] 
goal: [a].sublists' = [[], [a]]

full_name: List.sublists'Aux
code: /-- Auxiliary helper definition for `sublists'` -/
def sublists'Aux (a : α) (r₁ r₂ : List (List α)) : List (List α) 
goal: List (List α)

full_name: List.sublists'Aux_eq_array_foldl
code: theorem sublists'Aux_eq_array_foldl (a : α) : ∀ (r₁ r₂ : List (List α)),
    sublists'Aux a r₁ r₂ = ((r₁.toArray).foldl (init := r₂.toArray)
      (fun r l => r.push (a :: l))).toList 
goal: List.sublists'Aux a r₁ r₂ = (Array.foldl (fun r l => r.push (a :: l)) (List.toArray r₂) (List.toArray r₁) 0).toList

full_name: List.sublists'_eq_sublists'Aux
code: theorem sublists'_eq_sublists'Aux (l : List α) :
    sublists' l = l.foldr (fun a r => sublists'Aux a r r) [[]] 
goal: l.sublists' = List.foldr (fun a r => List.sublists'Aux a r r) [[]] l

full_name: List.sublists'Aux_eq_map
code: theorem sublists'Aux_eq_map (a : α) (r₁ : List (List α)) : ∀ (r₂ : List (List α)),
    sublists'Aux a r₁ r₂ = r₂ ++ map (cons a) r₁ 
goal: List.sublists'Aux a r₁ r₂ = r₂ ++ List.map (List.cons a) r₁

full_name: List.sublists'_cons
code: @[simp 900]
theorem sublists'_cons (a : α) (l : List α) :
    sublists' (a :: l) = sublists' l ++ map (cons a) (sublists' l) 
goal: (a :: l).sublists' = l.sublists' ++ List.map (List.cons a) l.sublists'

full_name: List.mem_sublists'
code: @[simp]
theorem mem_sublists' {s t : List α} : s ∈ sublists' t ↔ s <+ t 
goal: s ∈ t.sublists' ↔ s.Sublist t

full_name: List.length_sublists'
code: @[simp]
theorem length_sublists' : ∀ l : List α, length (sublists' l) = 2 ^ length l
  
goal: l.sublists'.length = 2 ^ l.length

full_name: List.sublists_nil
code: @[simp]
theorem sublists_nil : sublists (@nil α) = [[]] 
goal: [].sublists = [[]]

full_name: List.sublists_singleton
code: @[simp]
theorem sublists_singleton (a : α) : sublists [a] = [[], [a]] 
goal: [a].sublists = [[], [a]]

full_name: List.sublistsAux
code: /-- Auxiliary helper function for `sublists` -/
def sublistsAux (a : α) (r : List (List α)) : List (List α) 
goal: List (List α)

full_name: List.sublistsAux_eq_array_foldl
code: theorem sublistsAux_eq_array_foldl :
    sublistsAux = fun (a : α) (r : List (List α)) =>
      (r.toArray.foldl (init := #[])
        fun r l => (r.push l).push (a :: l)).toList 
goal: List.sublistsAux = fun a r => (Array.foldl (fun r l => (r.push l).push (a :: l)) #[] (List.toArray r) 0).toList

full_name: List.sublistsAux_eq_bind
code: theorem sublistsAux_eq_bind :
    sublistsAux = fun (a : α) (r : List (List α)) => r.bind fun l => [l, a :: l] 
goal: List.sublistsAux = fun a r => r.bind fun l => [l, a :: l]

full_name: List.sublists_eq_sublistsFast
code: @[csimp] theorem sublists_eq_sublistsFast : @sublists = @sublistsFast 
goal: @List.sublists = @List.sublistsFast

full_name: List.sublists_append
code: theorem sublists_append (l₁ l₂ : List α) :
    sublists (l₁ ++ l₂) = (sublists l₂) >>= (fun x => (sublists l₁).map (· ++ x)) 
goal: (l₁ ++ l₂).sublists = do
  let x ← l₂.sublists
  List.map (fun x_1 => x_1 ++ x) l₁.sublists

full_name: List.sublists_cons
code: theorem sublists_cons (a : α) (l : List α) :
    sublists (a :: l) = sublists l >>= (fun x => [x, a :: x]) 
goal: (a :: l).sublists = do
  let x ← l.sublists
  [x, a :: x]

full_name: List.sublists_concat
code: @[simp]
theorem sublists_concat (l : List α) (a : α) :
    sublists (l ++ [a]) = sublists l ++ map (fun x => x ++ [a]) (sublists l) 
goal: (l ++ [a]).sublists = l.sublists ++ List.map (fun x => x ++ [a]) l.sublists

full_name: List.sublists_reverse
code: theorem sublists_reverse (l : List α) : sublists (reverse l) = map reverse (sublists' l) 
goal: l.reverse.sublists = List.map List.reverse l.sublists'

full_name: List.sublists_eq_sublists'
code: theorem sublists_eq_sublists' (l : List α) : sublists l = map reverse (sublists' (reverse l)) 
goal: l.sublists = List.map List.reverse l.reverse.sublists'

full_name: List.sublists'_reverse
code: theorem sublists'_reverse (l : List α) : sublists' (reverse l) = map reverse (sublists l) 
goal: l.reverse.sublists' = List.map List.reverse l.sublists

full_name: List.sublists'_eq_sublists
code: theorem sublists'_eq_sublists (l : List α) : sublists' l = map reverse (sublists (reverse l)) 
goal: l.sublists' = List.map List.reverse l.reverse.sublists

full_name: List.mem_sublists
code: @[simp]
theorem mem_sublists {s t : List α} : s ∈ sublists t ↔ s <+ t 
goal: s ∈ t.sublists ↔ s.Sublist t

full_name: List.length_sublists
code: @[simp]
theorem length_sublists (l : List α) : length (sublists l) = 2 ^ length l 
goal: l.sublists.length = 2 ^ l.length

full_name: List.map_pure_sublist_sublists
code: theorem map_pure_sublist_sublists (l : List α) : map pure l <+ sublists l 
goal: (List.map pure l).Sublist l.sublists

full_name: List.map_ret_sublist_sublists
code: @[deprecated map_pure_sublist_sublists (since := "2024-03-24")]
theorem map_ret_sublist_sublists (l : List α) : map List.ret l <+ sublists l 
goal: (List.map List.ret l).Sublist l.sublists

full_name: List.sublistsLenAux
code: /-- Auxiliary function to construct the list of all sublists of a given length. Given an
integer `n`, a list `l`, a function `f` and an auxiliary list `L`, it returns the list made of
`f` applied to all sublists of `l` of length `n`, concatenated with `L`. -/
def sublistsLenAux : ℕ → List α → (List α → β) → List β → List β
  
goal: ℕ → List α → (List α → β) → List β → List β

full_name: List.sublistsLen
code: /-- The list of all sublists of a list `l` that are of length `n`. For instance, for
`l = [0, 1, 2, 3]` and `n = 2`, one gets
`[[2, 3], [1, 3], [1, 2], [0, 3], [0, 2], [0, 1]]`. -/
def sublistsLen (n : ℕ) (l : List α) : List (List α) 
goal: List (List α)

full_name: List.sublistsLenAux_append
code: theorem sublistsLenAux_append :
    ∀ (n : ℕ) (l : List α) (f : List α → β) (g : β → γ) (r : List β) (s : List γ),
      sublistsLenAux n l (g ∘ f) (r.map g ++ s) = (sublistsLenAux n l f r).map g ++ s
  
goal: List.sublistsLenAux n l (g ∘ f) (List.map g r ++ s) = List.map g (List.sublistsLenAux n l f r) ++ s

full_name: List.sublistsLenAux_eq
code: theorem sublistsLenAux_eq (l : List α) (n) (f : List α → β) (r) :
    sublistsLenAux n l f r = (sublistsLen n l).map f ++ r 
goal: List.sublistsLenAux n l f r = List.map f (List.sublistsLen n l) ++ r

full_name: List.sublistsLenAux_zero
code: theorem sublistsLenAux_zero (l : List α) (f : List α → β) (r) :
    sublistsLenAux 0 l f r = f [] :: r 
goal: List.sublistsLenAux 0 l f r = f [] :: r

full_name: List.sublistsLen_zero
code: @[simp]
theorem sublistsLen_zero (l : List α) : sublistsLen 0 l = [[]] 
goal: List.sublistsLen 0 l = [[]]

full_name: List.sublistsLen_succ_nil
code: @[simp]
theorem sublistsLen_succ_nil (n) : sublistsLen (n + 1) (@nil α) = [] 
goal: List.sublistsLen (n + 1) [] = []

full_name: List.sublistsLen_succ_cons
code: @[simp]
theorem sublistsLen_succ_cons (n) (a : α) (l) :
    sublistsLen (n + 1) (a :: l) = sublistsLen (n + 1) l ++ (sublistsLen n l).map (cons a) 
goal: List.sublistsLen (n + 1) (a :: l) = List.sublistsLen (n + 1) l ++ List.map (List.cons a) (List.sublistsLen n l)

full_name: List.sublistsLen_one
code: theorem sublistsLen_one (l : List α) : sublistsLen 1 l = l.reverse.map ([·]) 
goal: List.sublistsLen 1 l = List.map (fun x => [x]) l.reverse

full_name: List.length_sublistsLen
code: @[simp]
theorem length_sublistsLen :
    ∀ (n) (l : List α), length (sublistsLen n l) = Nat.choose (length l) n
  
goal: (List.sublistsLen n l).length = l.length.choose n

full_name: List.sublistsLen_sublist_sublists'
code: theorem sublistsLen_sublist_sublists' :
    ∀ (n) (l : List α), sublistsLen n l <+ sublists' l
  
goal: (List.sublistsLen n l).Sublist l.sublists'

full_name: List.sublistsLen_sublist_of_sublist
code: theorem sublistsLen_sublist_of_sublist (n) {l₁ l₂ : List α} (h : l₁ <+ l₂) :
    sublistsLen n l₁ <+ sublistsLen n l₂ 
goal: (List.sublistsLen n l₁).Sublist (List.sublistsLen n l₂)

full_name: List.length_of_sublistsLen
code: theorem length_of_sublistsLen :
    ∀ {n} {l l' : List α}, l' ∈ sublistsLen n l → length l' = n
  
goal: l' ∈ List.sublistsLen n l → l'.length = n

full_name: List.mem_sublistsLen_self
code: theorem mem_sublistsLen_self {l l' : List α} (h : l' <+ l) :
    l' ∈ sublistsLen (length l') l 
goal: l' ∈ List.sublistsLen l'.length l

full_name: List.mem_sublistsLen
code: @[simp]
theorem mem_sublistsLen {n} {l l' : List α} :
    l' ∈ sublistsLen n l ↔ l' <+ l ∧ length l' = n 
goal: l' ∈ List.sublistsLen n l ↔ l'.Sublist l ∧ l'.length = n

full_name: List.sublistsLen_of_length_lt
code: theorem sublistsLen_of_length_lt {n} {l : List α} (h : l.length < n) : sublistsLen n l = [] 
goal: List.sublistsLen n l = []

full_name: List.sublistsLen_length
code: @[simp]
theorem sublistsLen_length : ∀ l : List α, sublistsLen l.length l = [l]
  
goal: List.sublistsLen l.length l = [l]

full_name: List.Pairwise.sublists'
code: theorem Pairwise.sublists' {R} :
    ∀ {l : List α}, Pairwise R l → Pairwise (Lex (swap R)) (sublists' l)
  
goal: List.Pairwise R l → List.Pairwise (List.Lex (Function.swap R)) l.sublists'

full_name: List.pairwise_sublists
code: theorem pairwise_sublists {R} {l : List α} (H : Pairwise R l) :
    Pairwise (fun l₁ l₂ => Lex R (reverse l₁) (reverse l₂)) (sublists l) 
goal: List.Pairwise (fun l₁ l₂ => List.Lex R l₁.reverse l₂.reverse) l.sublists

full_name: List.nodup_sublists
code: @[simp]
theorem nodup_sublists {l : List α} : Nodup (sublists l) ↔ Nodup l 
goal: l.sublists.Nodup ↔ l.Nodup

full_name: List.nodup_sublists'
code: @[simp]
theorem nodup_sublists' {l : List α} : Nodup (sublists' l) ↔ Nodup l 
goal: l.sublists'.Nodup ↔ l.Nodup

full_name: List.nodup_sublistsLen
code: theorem nodup_sublistsLen (n : ℕ) {l : List α} (h : Nodup l) : (sublistsLen n l).Nodup 
goal: (List.sublistsLen n l).Nodup

full_name: List.sublists_map
code: theorem sublists_map (f : α → β) : ∀ (l : List α),
    sublists (map f l) = map (map f) (sublists l)
  
goal: (List.map f l).sublists = List.map (List.map f) l.sublists

full_name: List.sublists'_map
code: theorem sublists'_map (f : α → β) : ∀ (l : List α),
    sublists' (map f l) = map (map f) (sublists' l)
  
goal: (List.map f l).sublists' = List.map (List.map f) l.sublists'

full_name: List.sublists_perm_sublists'
code: theorem sublists_perm_sublists' (l : List α) : sublists l ~ sublists' l 
goal: l.sublists.Perm l.sublists'

full_name: List.sublists_cons_perm_append
code: theorem sublists_cons_perm_append (a : α) (l : List α) :
    sublists (a :: l) ~ sublists l ++ map (cons a) (sublists l) 
goal: (a :: l).sublists.Perm (l.sublists ++ List.map (List.cons a) l.sublists)

full_name: List.revzip_sublists
code: theorem revzip_sublists (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip l.sublists → l₁ ++ l₂ ~ l 
goal: (l₁, l₂) ∈ l.sublists.revzip → (l₁ ++ l₂).Perm l

full_name: List.revzip_sublists'
code: theorem revzip_sublists' (l : List α) : ∀ l₁ l₂, (l₁, l₂) ∈ revzip l.sublists' → l₁ ++ l₂ ~ l 
goal: (l₁, l₂) ∈ l.sublists'.revzip → (l₁ ++ l₂).Perm l

full_name: List.range_bind_sublistsLen_perm
code: theorem range_bind_sublistsLen_perm (l : List α) :
    ((List.range (l.length + 1)).bind fun n => sublistsLen n l) ~ sublists' l 
goal: ((List.range (l.length + 1)).bind fun n => List.sublistsLen n l).Perm l.sublists'