Lattice structure of lists #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This files prove basic properties about list.disjoint
, list.union
, list.inter
and
list.bag_inter
, which are defined in core Lean and data.list.defs
.
l₁ ∪ l₂
is the list where all elements of l₁
have been inserted in l₂
in order. For example,
[0, 0, 1, 2, 2, 3] ∪ [4, 3, 3, 0] = [1, 2, 4, 3, 3, 0]
l₁ ∩ l₂
is the list of elements of l₁
in order which are in l₂
. For example,
[0, 0, 1, 2, 2, 3] ∪ [4, 3, 3, 0] = [0, 0, 3]
bag_inter l₁ l₂
is the list of elements that are in both l₁
and l₂
, counted with multiplicity
and in the order they appear in l₁
. As opposed to list.inter
, list.bag_inter
copes well with
multiplicity. For example,
bag_inter [0, 1, 2, 3, 2, 1, 0] [1, 0, 1, 4, 3] = [0, 1, 3, 1]