File: Mathlib/Data/List/MinMax.lean

full_name: List.argAux
code: /-- Auxiliary definition for `argmax` and `argmin`. -/
def argAux (a : Option α) (b : α) : Option α 
goal: Option α

full_name: List.foldl_argAux_eq_none
code: @[simp]
theorem foldl_argAux_eq_none : l.foldl (argAux r) o = none ↔ l = [] ∧ o = none 
goal: List.foldl (List.argAux r) o l = none ↔ l = [] ∧ o = none

full_name: _private.Mathlib.Data.List.MinMax.0.List.foldl_argAux_mem
code: private theorem foldl_argAux_mem (l) : ∀ a m : α, m ∈ foldl (argAux r) (some a) l → m ∈ a :: l 
goal: m ∈ List.foldl (List.argAux r) (some a) l → m ∈ a :: l

full_name: List.argAux_self
code: @[simp]
theorem argAux_self (hr₀ : Irreflexive r) (a : α) : argAux r (some a) a = a 
goal: List.argAux r (some a) a = some a

full_name: List.not_of_mem_foldl_argAux
code: theorem not_of_mem_foldl_argAux (hr₀ : Irreflexive r) (hr₁ : Transitive r) :
    ∀ {a m : α} {o : Option α}, a ∈ l → m ∈ foldl (argAux r) o l → ¬r a m 
goal: a ∈ l → m ∈ List.foldl (List.argAux r) o l → ¬r a m

full_name: List.argmax
code: /-- `argmax f l` returns `some a`, where `f a` is maximal among the elements of `l`, in the sense
that there is no `b ∈ l` with `f a < f b`. If `a`, `b` are such that `f a = f b`, it returns
whichever of `a` or `b` comes first in the list. `argmax f [] = none`. -/
def argmax (f : α → β) (l : List α) : Option α 
goal: Option α

full_name: List.argmin
code: /-- `argmin f l` returns `some a`, where `f a` is minimal among the elements of `l`, in the sense
that there is no `b ∈ l` with `f b < f a`. If `a`, `b` are such that `f a = f b`, it returns
whichever of `a` or `b` comes first in the list. `argmin f [] = none`. -/
def argmin (f : α → β) (l : List α) 
goal: Option α

full_name: List.argmax_nil
code: @[simp]
theorem argmax_nil (f : α → β) : argmax f [] = none 
goal: List.argmax f [] = none

full_name: List.argmin_nil
code: @[simp]
theorem argmin_nil (f : α → β) : argmin f [] = none 
goal: List.argmin f [] = none

full_name: List.argmax_singleton
code: @[simp]
theorem argmax_singleton {f : α → β} {a : α} : argmax f [a] = a 
goal: List.argmax f [a] = some a

full_name: List.argmin_singleton
code: @[simp]
theorem argmin_singleton {f : α → β} {a : α} : argmin f [a] = a 
goal: List.argmin f [a] = some a

full_name: List.not_lt_of_mem_argmax
code: theorem not_lt_of_mem_argmax : a ∈ l → m ∈ argmax f l → ¬f m < f a 
goal: a ∈ l → m ∈ List.argmax f l → ¬f m < f a

full_name: List.not_lt_of_mem_argmin
code: theorem not_lt_of_mem_argmin : a ∈ l → m ∈ argmin f l → ¬f a < f m 
goal: a ∈ l → m ∈ List.argmin f l → ¬f a < f m

full_name: List.argmax_concat
code: theorem argmax_concat (f : α → β) (a : α) (l : List α) :
    argmax f (l ++ [a]) =
      Option.casesOn (argmax f l) (some a) fun c => if f c < f a then some a else some c 
goal: List.argmax f (l ++ [a]) = Option.casesOn (List.argmax f l) (some a) fun c => if f c < f a then some a else some c

full_name: List.argmin_concat
code: theorem argmin_concat (f : α → β) (a : α) (l : List α) :
    argmin f (l ++ [a]) =
      Option.casesOn (argmin f l) (some a) fun c => if f a < f c then some a else some c 
goal: List.argmin f (l ++ [a]) = Option.casesOn (List.argmin f l) (some a) fun c => if f a < f c then some a else some c

full_name: List.argmax_mem
code: theorem argmax_mem : ∀ {l : List α} {m : α}, m ∈ argmax f l → m ∈ l
  
goal: m ∈ List.argmax f l → m ∈ l

full_name: List.argmin_mem
code: theorem argmin_mem : ∀ {l : List α} {m : α}, m ∈ argmin f l → m ∈ l 
goal: m ∈ List.argmin f l → m ∈ l

full_name: List.argmax_eq_none
code: @[simp]
theorem argmax_eq_none : l.argmax f = none ↔ l = [] 
goal: List.argmax f l = none ↔ l = []

full_name: List.argmin_eq_none
code: @[simp]
theorem argmin_eq_none : l.argmin f = none ↔ l = [] 
goal: List.argmin f l = none ↔ l = []

full_name: List.le_of_mem_argmax
code: theorem le_of_mem_argmax : a ∈ l → m ∈ argmax f l → f a ≤ f m 
goal: a ∈ l → m ∈ List.argmax f l → f a ≤ f m

full_name: List.le_of_mem_argmin
code: theorem le_of_mem_argmin : a ∈ l → m ∈ argmin f l → f m ≤ f a 
goal: a ∈ l → m ∈ List.argmin f l → f m ≤ f a

full_name: List.argmax_cons
code: theorem argmax_cons (f : α → β) (a : α) (l : List α) :
    argmax f (a :: l) =
      Option.casesOn (argmax f l) (some a) fun c => if f a < f c then some c else some a 
goal: List.argmax f (a :: l) = Option.casesOn (List.argmax f l) (some a) fun c => if f a < f c then some c else some a

full_name: List.argmin_cons
code: theorem argmin_cons (f : α → β) (a : α) (l : List α) :
    argmin f (a :: l) =
      Option.casesOn (argmin f l) (some a) fun c => if f c < f a then some c else some a 
goal: List.argmin f (a :: l) = Option.casesOn (List.argmin f l) (some a) fun c => if f c < f a then some c else some a

full_name: List.index_of_argmax
code: theorem index_of_argmax :
    ∀ {l : List α} {m : α}, m ∈ argmax f l → ∀ {a}, a ∈ l → f m ≤ f a → l.indexOf m ≤ l.indexOf a
  
goal: m ∈ List.argmax f l → ∀ {a : α}, a ∈ l → f m ≤ f a → List.indexOf m l ≤ List.indexOf a l

full_name: List.index_of_argmin
code: theorem index_of_argmin :
    ∀ {l : List α} {m : α}, m ∈ argmin f l → ∀ {a}, a ∈ l → f a ≤ f m → l.indexOf m ≤ l.indexOf a 
goal: m ∈ List.argmin f l → ∀ {a : α}, a ∈ l → f a ≤ f m → List.indexOf m l ≤ List.indexOf a l

full_name: List.mem_argmax_iff
code: theorem mem_argmax_iff :
    m ∈ argmax f l ↔
      m ∈ l ∧ (∀ a ∈ l, f a ≤ f m) ∧ ∀ a ∈ l, f m ≤ f a → l.indexOf m ≤ l.indexOf a 
goal: m ∈ List.argmax f l ↔
  m ∈ l ∧ (∀ (a : α), a ∈ l → f a ≤ f m) ∧ ∀ (a : α), a ∈ l → f m ≤ f a → List.indexOf m l ≤ List.indexOf a l

full_name: List.argmax_eq_some_iff
code: theorem argmax_eq_some_iff :
    argmax f l = some m ↔
      m ∈ l ∧ (∀ a ∈ l, f a ≤ f m) ∧ ∀ a ∈ l, f m ≤ f a → l.indexOf m ≤ l.indexOf a 
goal: List.argmax f l = some m ↔
  m ∈ l ∧ (∀ (a : α), a ∈ l → f a ≤ f m) ∧ ∀ (a : α), a ∈ l → f m ≤ f a → List.indexOf m l ≤ List.indexOf a l

full_name: List.mem_argmin_iff
code: theorem mem_argmin_iff :
    m ∈ argmin f l ↔
      m ∈ l ∧ (∀ a ∈ l, f m ≤ f a) ∧ ∀ a ∈ l, f a ≤ f m → l.indexOf m ≤ l.indexOf a 
goal: m ∈ List.argmin f l ↔
  m ∈ l ∧ (∀ (a : α), a ∈ l → f m ≤ f a) ∧ ∀ (a : α), a ∈ l → f a ≤ f m → List.indexOf m l ≤ List.indexOf a l

full_name: List.argmin_eq_some_iff
code: theorem argmin_eq_some_iff :
    argmin f l = some m ↔
      m ∈ l ∧ (∀ a ∈ l, f m ≤ f a) ∧ ∀ a ∈ l, f a ≤ f m → l.indexOf m ≤ l.indexOf a 
goal: List.argmin f l = some m ↔
  m ∈ l ∧ (∀ (a : α), a ∈ l → f m ≤ f a) ∧ ∀ (a : α), a ∈ l → f a ≤ f m → List.indexOf m l ≤ List.indexOf a l

full_name: List.maximum
code: /-- `maximum l` returns a `WithBot α`, the largest element of `l` for nonempty lists, and `⊥` for
`[]`  -/
def maximum (l : List α) : WithBot α 
goal: WithBot α

full_name: List.minimum
code: /-- `minimum l` returns a `WithTop α`, the smallest element of `l` for nonempty lists, and `⊤` for
`[]`  -/
def minimum (l : List α) : WithTop α 
goal: WithTop α

full_name: List.maximum_nil
code: @[simp]
theorem maximum_nil : maximum ([] : List α) = ⊥ 
goal: [].maximum = ⊥

full_name: List.minimum_nil
code: @[simp]
theorem minimum_nil : minimum ([] : List α) = ⊤ 
goal: [].minimum = ⊤

full_name: List.maximum_singleton
code: @[simp]
theorem maximum_singleton (a : α) : maximum [a] = a 
goal: [a].maximum = ↑a

full_name: List.minimum_singleton
code: @[simp]
theorem minimum_singleton (a : α) : minimum [a] = a 
goal: [a].minimum = ↑a

full_name: List.maximum_mem
code: theorem maximum_mem {l : List α} {m : α} : (maximum l : WithTop α) = m → m ∈ l 
goal: l.maximum = ↑m → m ∈ l

full_name: List.minimum_mem
code: theorem minimum_mem {l : List α} {m : α} : (minimum l : WithBot α) = m → m ∈ l 
goal: l.minimum = ↑m → m ∈ l

full_name: List.maximum_eq_bot
code: @[simp]
theorem maximum_eq_bot {l : List α} : l.maximum = ⊥ ↔ l = [] 
goal: l.maximum = ⊥ ↔ l = []

full_name: List.maximum_eq_none
code: @[simp, deprecated maximum_eq_bot "Don't mix Option and WithBot" (since := "2024-05-27")]
theorem maximum_eq_none {l : List α} : l.maximum = none ↔ l = [] 
goal: l.maximum = none ↔ l = []

full_name: List.minimum_eq_top
code: @[simp]
theorem minimum_eq_top {l : List α} : l.minimum = ⊤ ↔ l = [] 
goal: l.minimum = ⊤ ↔ l = []

full_name: List.minimum_eq_none
code: @[simp, deprecated minimum_eq_top "Don't mix Option and WithTop" (since := "2024-05-27")]
theorem minimum_eq_none {l : List α} : l.minimum = none ↔ l = [] 
goal: l.minimum = none ↔ l = []

full_name: List.not_lt_maximum_of_mem
code: theorem not_lt_maximum_of_mem : a ∈ l → (maximum l : WithBot α) = m → ¬m < a 
goal: a ∈ l → l.maximum = ↑m → ¬m < a

full_name: List.minimum_not_lt_of_mem
code: theorem minimum_not_lt_of_mem : a ∈ l → (minimum l : WithTop α) = m → ¬a < m 
goal: a ∈ l → l.minimum = ↑m → ¬a < m

full_name: List.not_lt_maximum_of_mem'
code: theorem not_lt_maximum_of_mem' (ha : a ∈ l) : ¬maximum l < (a : WithBot α) 
goal: ¬l.maximum < ↑a

full_name: List.not_lt_minimum_of_mem'
code: theorem not_lt_minimum_of_mem' (ha : a ∈ l) : ¬(a : WithTop α) < minimum l 
goal: ¬↑a < l.minimum

full_name: List.maximum_concat
code: theorem maximum_concat (a : α) (l : List α) : maximum (l ++ [a]) = max (maximum l) a 
goal: (l ++ [a]).maximum = max l.maximum ↑a

full_name: List.le_maximum_of_mem
code: theorem le_maximum_of_mem : a ∈ l → (maximum l : WithBot α) = m → a ≤ m 
goal: a ∈ l → l.maximum = ↑m → a ≤ m

full_name: List.minimum_le_of_mem
code: theorem minimum_le_of_mem : a ∈ l → (minimum l : WithTop α) = m → m ≤ a 
goal: a ∈ l → l.minimum = ↑m → m ≤ a

full_name: List.le_maximum_of_mem'
code: theorem le_maximum_of_mem' (ha : a ∈ l) : (a : WithBot α) ≤ maximum l 
goal: ↑a ≤ l.maximum

full_name: List.minimum_le_of_mem'
code: theorem minimum_le_of_mem' (ha : a ∈ l) : minimum l ≤ (a : WithTop α) 
goal: l.minimum ≤ ↑a

full_name: List.minimum_concat
code: theorem minimum_concat (a : α) (l : List α) : minimum (l ++ [a]) = min (minimum l) a 
goal: (l ++ [a]).minimum = min l.minimum ↑a

full_name: List.maximum_cons
code: theorem maximum_cons (a : α) (l : List α) : maximum (a :: l) = max ↑a (maximum l) 
goal: (a :: l).maximum = max (↑a) l.maximum

full_name: List.minimum_cons
code: theorem minimum_cons (a : α) (l : List α) : minimum (a :: l) = min ↑a (minimum l) 
goal: (a :: l).minimum = min (↑a) l.minimum

full_name: List.maximum_le_of_forall_le
code: theorem maximum_le_of_forall_le {b : WithBot α} (h : ∀ a ∈ l, a ≤ b) : l.maximum ≤ b 
goal: l.maximum ≤ b

full_name: List.le_minimum_of_forall_le
code: theorem le_minimum_of_forall_le {b : WithTop α} (h : ∀ a ∈ l, b ≤ a) : b ≤ l.minimum 
goal: b ≤ l.minimum

full_name: List.maximum_eq_coe_iff
code: theorem maximum_eq_coe_iff : maximum l = m ↔ m ∈ l ∧ ∀ a ∈ l, a ≤ m 
goal: l.maximum = ↑m ↔ m ∈ l ∧ ∀ (a : α), a ∈ l → a ≤ m

full_name: List.minimum_eq_coe_iff
code: theorem minimum_eq_coe_iff : minimum l = m ↔ m ∈ l ∧ ∀ a ∈ l, m ≤ a 
goal: l.minimum = ↑m ↔ m ∈ l ∧ ∀ (a : α), a ∈ l → m ≤ a

full_name: List.coe_le_maximum_iff
code: theorem coe_le_maximum_iff : a ≤ l.maximum ↔ ∃ b, b ∈ l ∧ a ≤ b 
goal: ↑a ≤ l.maximum ↔ ∃ b, b ∈ l ∧ a ≤ b

full_name: List.minimum_le_coe_iff
code: theorem minimum_le_coe_iff : l.minimum ≤ a ↔ ∃ b, b ∈ l ∧ b ≤ a 
goal: l.minimum ≤ ↑a ↔ ∃ b, b ∈ l ∧ b ≤ a

full_name: List.maximum_ne_bot_of_ne_nil
code: theorem maximum_ne_bot_of_ne_nil (h : l ≠ []) : l.maximum ≠ ⊥ 
goal: l.maximum ≠ ⊥

full_name: List.minimum_ne_top_of_ne_nil
code: theorem minimum_ne_top_of_ne_nil (h : l ≠ []) : l.minimum ≠ ⊤ 
goal: l.minimum ≠ ⊤

full_name: List.maximum_ne_bot_of_length_pos
code: theorem maximum_ne_bot_of_length_pos (h : 0 < l.length) : l.maximum ≠ ⊥ 
goal: l.maximum ≠ ⊥

full_name: List.minimum_ne_top_of_length_pos
code: theorem minimum_ne_top_of_length_pos (h : 0 < l.length) : l.minimum ≠ ⊤ 
goal: l.minimum ≠ ⊤

full_name: List.maximum_of_length_pos
code: /-- The maximum value in a non-empty `List`. -/
def maximum_of_length_pos (h : 0 < l.length) : α 
goal: α

full_name: List.minimum_of_length_pos
code: /-- The minimum value in a non-empty `List`. -/
def minimum_of_length_pos (h : 0 < l.length) : α 
goal: α

full_name: List.coe_maximum_of_length_pos
code: @[simp]
lemma coe_maximum_of_length_pos (h : 0 < l.length) :
    (l.maximum_of_length_pos h : α) = l.maximum 
goal: ↑(List.maximum_of_length_pos h) = l.maximum

full_name: List.coe_minimum_of_length_pos
code: @[simp]
lemma coe_minimum_of_length_pos (h : 0 < l.length) :
    (l.minimum_of_length_pos h : α) = l.minimum 
goal: ↑(List.minimum_of_length_pos h) = l.minimum

full_name: List.le_maximum_of_length_pos_iff
code: @[simp]
theorem le_maximum_of_length_pos_iff {b : α} (h : 0 < l.length) :
    b ≤ maximum_of_length_pos h ↔ b ≤ l.maximum 
goal: b ≤ List.maximum_of_length_pos h ↔ ↑b ≤ l.maximum

full_name: List.minimum_of_length_pos_le_iff
code: @[simp]
theorem minimum_of_length_pos_le_iff {b : α} (h : 0 < l.length) :
    minimum_of_length_pos h ≤ b ↔ l.minimum ≤ b 
goal: List.minimum_of_length_pos h ≤ b ↔ l.minimum ≤ ↑b

full_name: List.maximum_of_length_pos_mem
code: theorem maximum_of_length_pos_mem (h : 0 < l.length) :
    maximum_of_length_pos h ∈ l 
goal: List.maximum_of_length_pos h ∈ l

full_name: List.minimum_of_length_pos_mem
code: theorem minimum_of_length_pos_mem (h : 0 < l.length) :
    minimum_of_length_pos h ∈ l 
goal: List.minimum_of_length_pos h ∈ l

full_name: List.le_maximum_of_length_pos_of_mem
code: theorem le_maximum_of_length_pos_of_mem (h : a ∈ l) (w : 0 < l.length) :
    a ≤ l.maximum_of_length_pos w 
goal: a ≤ List.maximum_of_length_pos w

full_name: List.minimum_of_length_pos_le_of_mem
code: theorem minimum_of_length_pos_le_of_mem (h : a ∈ l) (w : 0 < l.length) :
    l.minimum_of_length_pos w ≤ a 
goal: List.minimum_of_length_pos w ≤ a

full_name: List.getElem_le_maximum_of_length_pos
code: theorem getElem_le_maximum_of_length_pos {i : ℕ} (w : i < l.length) (h := (Nat.zero_lt_of_lt w)) :
    l[i] ≤ l.maximum_of_length_pos h 
goal: l[i] ≤ List.maximum_of_length_pos h

full_name: List.minimum_of_length_pos_le_getElem
code: theorem minimum_of_length_pos_le_getElem {i : ℕ} (w : i < l.length) (h := (Nat.zero_lt_of_lt w)) :
    l.minimum_of_length_pos h ≤ l[i] 
goal: List.minimum_of_length_pos h ≤ l[i]

full_name: List.getD_maximum?_eq_unbot'_maximum
code: lemma getD_maximum?_eq_unbot'_maximum (l : List α) (d : α) :
    l.maximum?.getD d = l.maximum.unbot' d 
goal: l.maximum?.getD d = WithBot.unbot' d l.maximum

full_name: List.getD_minimum?_eq_untop'_minimum
code: lemma getD_minimum?_eq_untop'_minimum (l : List α) (d : α) :
    l.minimum?.getD d = l.minimum.untop' d 
goal: l.minimum?.getD d = WithTop.untop' d l.minimum

full_name: List.foldr_max_of_ne_nil
code: @[simp]
theorem foldr_max_of_ne_nil (h : l ≠ []) : ↑(l.foldr max ⊥) = l.maximum 
goal: ↑(List.foldr max ⊥ l) = l.maximum

full_name: List.max_le_of_forall_le
code: theorem max_le_of_forall_le (l : List α) (a : α) (h : ∀ x ∈ l, x ≤ a) : l.foldr max ⊥ ≤ a 
goal: List.foldr max ⊥ l ≤ a

full_name: List.le_max_of_le
code: theorem le_max_of_le {l : List α} {a x : α} (hx : x ∈ l) (h : a ≤ x) : a ≤ l.foldr max ⊥ 
goal: a ≤ List.foldr max ⊥ l

full_name: List.foldr_min_of_ne_nil
code: @[simp]
theorem foldr_min_of_ne_nil (h : l ≠ []) : ↑(l.foldr min ⊤) = l.minimum 
goal: ↑(List.foldr min ⊤ l) = l.minimum

full_name: List.le_min_of_forall_le
code: theorem le_min_of_forall_le (l : List α) (a : α) (h : ∀ x ∈ l, a ≤ x) : a ≤ l.foldr min ⊤ 
goal: a ≤ List.foldr min ⊤ l

full_name: List.min_le_of_le
code: theorem min_le_of_le (l : List α) (a : α) {x : α} (hx : x ∈ l) (h : x ≤ a) : l.foldr min ⊤ ≤ a 
goal: List.foldr min ⊤ l ≤ a