Minima and maxima #
min? #
theorem
List.min?_cons'
{α : Type u_1}
{x : α}
[Min α]
{xs : List α}
:
(x :: xs).min? = some (List.foldl min x xs)
@[simp]
theorem
List.foldl_min
{α : Type u_1}
[Min α]
[Std.IdempotentOp min]
[Std.Associative min]
{l : List α}
{a : α}
:
List.foldl min a l = min a (l.min?.getD a)
max? #
theorem
List.max?_cons'
{α : Type u_1}
{x : α}
[Max α]
{xs : List α}
:
(x :: xs).max? = some (List.foldl max x xs)
@[simp]
theorem
List.foldl_max
{α : Type u_1}
[Max α]
[Std.IdempotentOp max]
[Std.Associative max]
{l : List α}
{a : α}
:
List.foldl max a l = max a (l.max?.getD a)
@[reducible, inline, deprecated List.min?_nil]
Equations
Instances For
@[reducible, inline, deprecated List.min?_cons]
Equations
Instances For
@[reducible, inline, deprecated List.min?_eq_none_iff]
Instances For
@[reducible, inline, deprecated List.min?_eq_some_iff]
abbrev
List.minimum?_eq_some_iff
{α : Type u_1}
{a : α}
[Min α]
[LE α]
[anti : Antisymm fun (x1 x2 : α) => x1 ≤ x2]
(le_refl : ∀ (a : α), a ≤ a)
(min_eq_or : ∀ (a b : α), min a b = a ∨ min a b = b)
(le_min_iff : ∀ (a b c : α), a ≤ min b c ↔ a ≤ b ∧ a ≤ c)
{xs : List α}
:
Instances For
@[reducible, inline, deprecated List.min?_replicate]
abbrev
List.minimum?_replicate
{α : Type u_1}
[Min α]
{n : Nat}
{a : α}
(w : min a a = a)
:
(List.replicate n a).min? = if n = 0 then none else some a
Instances For
@[reducible, inline, deprecated List.min?_replicate_of_pos]
abbrev
List.minimum?_replicate_of_pos
{α : Type u_1}
[Min α]
{n : Nat}
{a : α}
(w : min a a = a)
(h : 0 < n)
:
(List.replicate n a).min? = some a
Instances For
@[reducible, inline, deprecated List.max?_nil]
Equations
Instances For
@[reducible, inline, deprecated List.max?_cons]
Equations
Instances For
@[reducible, inline, deprecated List.max?_eq_none_iff]
Instances For
@[reducible, inline, deprecated List.max?_eq_some_iff]
abbrev
List.maximum?_eq_some_iff
{α : Type u_1}
{a : α}
[Max α]
[LE α]
[anti : Antisymm fun (x1 x2 : α) => x1 ≤ x2]
(le_refl : ∀ (a : α), a ≤ a)
(max_eq_or : ∀ (a b : α), max a b = a ∨ max a b = b)
(max_le_iff : ∀ (a b c : α), max b c ≤ a ↔ b ≤ a ∧ c ≤ a)
{xs : List α}
:
Instances For
@[reducible, inline, deprecated List.max?_replicate]
abbrev
List.maximum?_replicate
{α : Type u_1}
[Max α]
{n : Nat}
{a : α}
(w : max a a = a)
:
(List.replicate n a).max? = if n = 0 then none else some a
Instances For
@[reducible, inline, deprecated List.max?_replicate_of_pos]
abbrev
List.maximum?_replicate_of_pos
{α : Type u_1}
[Max α]
{n : Nat}
{a : α}
(w : max a a = a)
(h : 0 < n)
:
(List.replicate n a).max? = some a