Join of a list of lists #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file proves basic properties of list.join
, which concatenates a list of lists. It is defined
in data.list.defs
.
In a join, taking the first elements up to an index which is the sum of the lengths of the
first i
sublists, is the same as taking the join of the first i
sublists.
In a join, dropping all the elements up to an index which is the sum of the lengths of the
first i
sublists, is the same as taking the join after dropping the first i
sublists.
In a join of sublists, taking the slice between the indices A
and B - 1
gives back the
original sublist of index i
if A
is the sum of the lenghts of sublists of index < i
, and
B
is the sum of the lengths of sublists of index ≤ i
.
The n
-th element in a join of sublists is the j
-th element of the i
th sublist,
where n
can be obtained in terms of i
and j
by adding the lengths of all the sublists
of index < i
, and adding j
.
We can rebracket x ++ (l₁ ++ x) ++ (l₂ ++ x) ++ ... ++ (lₙ ++ x)
to
(x ++ l₁) ++ (x ++ l₂) ++ ... ++ (x ++ lₙ) ++ x
where L = [l₁, l₂, ..., lₙ]
.