Pairwise relations on a list #
This file provides basic results about List.Pairwise
and List.pwFilter
(definitions are in
Batteries.Data.List.Basic
).
Pairwise r [a 0, ..., a (n - 1)]
means ∀ i j, i < j → r (a i) (a j)
. For example,
Pairwise (≠) l
means that all elements of l
are distinct, and Pairwise (<) l
means that l
is strictly increasing.
pwFilter r l
is the list obtained by iteratively adding each element of l
that doesn't break
the pairwiseness of the list we have so far. It thus yields l'
a maximal sublist of l
such that
Pairwise r l'
.
Tags #
sorted, nodup
Pairwise #
Pairwise filtering #
@[simp]
theorem
List.pwFilter_sublist
{α : Type u_1}
{R : α → α → Prop}
[DecidableRel R]
(l : List α)
:
(pwFilter R l).Sublist l
@[simp]