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
@[reducible, inline, deprecated List.min?_cons]
Equations
@[reducible, inline, deprecated List.min?_eq_none_iff]
@[reducible, inline, deprecated List.min?_eq_some_iff]
@[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
@[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
@[reducible, inline, deprecated List.max?_nil]
Equations
@[reducible, inline, deprecated List.max?_cons]
Equations
@[reducible, inline, deprecated List.max?_eq_none_iff]
@[reducible, inline, deprecated List.max?_eq_some_iff]
@[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
@[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