Documentation

Mathlib.Data.List.GroupBy

Group consecutive elements in a list by a relation #

This file provides the basic API for List.groupBy which is defined in Core. The main results are the following:

@[simp]
theorem List.groupBy_nil {α : Type u_1} (r : ααBool) :
List.groupBy r [] = []
@[simp]
theorem List.join_groupBy {α : Type u_1} (r : ααBool) (l : List α) :
(List.groupBy r l).join = l
theorem List.nil_not_mem_groupBy {α : Type u_1} (r : ααBool) (l : List α) :
theorem List.ne_nil_of_mem_groupBy {α : Type u_1} {m : List α} (r : ααBool) {l : List α} (h : m List.groupBy r l) :
m []
theorem List.chain'_of_mem_groupBy {α : Type u_1} {m : List α} {r : ααBool} {l : List α} (h : m List.groupBy r l) :
List.Chain' (fun (x y : α) => r x y = true) m
theorem List.chain'_getLast_head_groupBy {α : Type u_1} (r : ααBool) (l : List α) :
List.Chain' (fun (a b : List α) => ∃ (ha : a []), ∃ (hb : b []), r (a.getLast ha) (b.head hb) = false) (List.groupBy r l)