List Permutations #
This file introduces the List.Perm
relation, which is true if two lists are permutations of one
another.
Notation #
The notation ~
is used for permutation equivalence.
- nil: ∀ {α : Type uu}, [] ~ []
- cons: ∀ {α : Type uu} (x : α) {l₁ l₂ : List α}, l₁ ~ l₂ → x :: l₁ ~ x :: l₂
- swap: ∀ {α : Type uu} (x y : α) (l : List α), y :: x :: l ~ x :: y :: l
- trans: ∀ {α : Type uu} {l₁ l₂ l₃ : List α}, l₁ ~ l₂ → l₂ ~ l₃ → l₁ ~ l₃
Perm l₁ l₂
or l₁ ~ l₂
asserts that l₁
and l₂
are permutations
of each other. This is defined by induction using pairwise swaps.
Instances For
Perm l₁ l₂
or l₁ ~ l₂
asserts that l₁
and l₂
are permutations
of each other. This is defined by induction using pairwise swaps.
Equations
- List.«term_~_» = Lean.ParserDescr.trailingNode `List.term_~_ 50 50 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ~ ") (Lean.ParserDescr.cat `term 51))
Instances For
Equations
- List.isSetoid α = { r := List.Perm, iseqv := (_ : Equivalence List.Perm) }
Alias of the forward direction of List.perm_singleton
.
Alias of the forward direction of List.singleton_perm
.
Subperm l₁ l₂
, denoted l₁ <+~ l₂
, means that l₁
is a sublist of
a permutation of l₂
. This is an analogue of l₁ ⊆ l₂
which respects
multiplicities of elements, and is used for the ≤
relation on multisets.
Equations
- (l₁ <+~ l₂) = ∃ l x, List.Sublist l l₂
Instances For
Subperm l₁ l₂
, denoted l₁ <+~ l₂
, means that l₁
is a sublist of
a permutation of l₂
. This is an analogue of l₁ ⊆ l₂
which respects
multiplicities of elements, and is used for the ≤
relation on multisets.
Equations
- List.«term_<+~_» = Lean.ParserDescr.trailingNode `List.term_<+~_ 50 50 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " <+~ ") (Lean.ParserDescr.cat `term 51))
Instances For
Alias of the reverse direction of List.subperm_cons
.
Alias of the forward direction of List.subperm_cons
.
The list version of add_tsub_cancel_of_le
for multisets.
The list version of Multiset.le_iff_count
.
Equations
- List.decidableSubperm x x = decidable_of_iff (∀ (x : α), x ∈ x → List.count x x ≤ List.count x x) (_ : (∀ (x : α), x ∈ x → List.count x x ≤ List.count x x) ↔ x <+~ x)
Equations
- List.decidablePerm [] [] = isTrue (_ : [] ~ [])
- List.decidablePerm [] (b :: l₂) = isFalse (_ : [] ~ b :: l₂ → List.noConfusionType False [] (b :: l₂))
- List.decidablePerm (a :: l₁) x = decidable_of_iff' (a ∈ x ∧ l₁ ~ List.erase x a) (_ : a :: l₁ ~ x ↔ a ∈ x ∧ l₁ ~ List.erase x a)