Documentation

Mathlib.GroupTheory.Perm.List

Permutations from a list #

A list l : List α can be interpreted as an Equiv.Perm α where each element in the list is permuted to the next one, defined as formPerm. When we have that Nodup l, we prove that Equiv.Perm.support (formPerm l) = l.toFinset, and that formPerm l is rotationally invariant, in formPerm_rotate.

When there are duplicate elements in l, how and in what arrangement with respect to the other elements they appear in the list determines the formed permutation. This is because List.formPerm is implemented as a product of Equiv.swaps. That means that presence of a sublist of two adjacent duplicates like [..., x, x, ...] will produce the same permutation as if the adjacent duplicates were not present.

The List.formPerm definition is meant to primarily be used with Nodup l, so that the resulting permutation is cyclic (if l has at least two elements). The presence of duplicates in a particular placement can lead List.formPerm to produce a nontrivial permutation that is noncyclic.

def List.formPerm {α : Type u_1} [DecidableEq α] (l : List α) :

A list l : List α can be interpreted as an Equiv.Perm α where each element in the list is permuted to the next one, defined as formPerm. When we have that Nodup l, we prove that Equiv.Perm.support (formPerm l) = l.toFinset, and that formPerm l is rotationally invariant, in formPerm_rotate.

Equations
Instances For
    @[simp]
    theorem List.formPerm_nil {α : Type u_1} [DecidableEq α] :
    @[simp]
    theorem List.formPerm_singleton {α : Type u_1} [DecidableEq α] (x : α) :
    @[simp]
    theorem List.formPerm_cons_cons {α : Type u_1} [DecidableEq α] (x : α) (y : α) (l : List α) :
    theorem List.formPerm_pair {α : Type u_1} [DecidableEq α] (x : α) (y : α) :
    theorem List.mem_or_mem_of_zipWith_swap_prod_ne {α : Type u_1} [DecidableEq α] {l : List α} {l' : List α} {x : α} :
    (List.prod (List.zipWith Equiv.swap l l')) x xx l x l'
    theorem List.zipWith_swap_prod_support' {α : Type u_1} [DecidableEq α] (l : List α) (l' : List α) :
    {x : α | (List.prod (List.zipWith Equiv.swap l l')) x x} (List.toFinset l List.toFinset l')
    theorem List.support_formPerm_le' {α : Type u_1} [DecidableEq α] (l : List α) :
    {x : α | (List.formPerm l) x x} (List.toFinset l)
    theorem List.mem_of_formPerm_apply_ne {α : Type u_1} [DecidableEq α] {l : List α} {x : α} (h : (List.formPerm l) x x) :
    x l
    theorem List.formPerm_apply_of_not_mem {α : Type u_1} [DecidableEq α] {l : List α} {x : α} (h : xl) :
    theorem List.formPerm_apply_mem_of_mem {α : Type u_1} [DecidableEq α] {l : List α} {x : α} (h : x l) :
    theorem List.mem_of_formPerm_apply_mem {α : Type u_1} [DecidableEq α] {l : List α} {x : α} (h : (List.formPerm l) x l) :
    x l
    @[simp]
    theorem List.formPerm_mem_iff_mem {α : Type u_1} [DecidableEq α] {l : List α} {x : α} :
    (List.formPerm l) x l x l
    @[simp]
    theorem List.formPerm_cons_concat_apply_last {α : Type u_1} [DecidableEq α] (x : α) (y : α) (xs : List α) :
    (List.formPerm (x :: (xs ++ [y]))) y = x
    @[simp]
    theorem List.formPerm_apply_getLast {α : Type u_1} [DecidableEq α] (x : α) (xs : List α) :
    (List.formPerm (x :: xs)) (List.getLast (x :: xs) ) = x
    @[simp]
    theorem List.formPerm_apply_nthLe_length {α : Type u_1} [DecidableEq α] (x : α) (xs : List α) :
    (List.formPerm (x :: xs)) (List.nthLe (x :: xs) (List.length xs) ) = x
    theorem List.formPerm_apply_head {α : Type u_1} [DecidableEq α] (x : α) (y : α) (xs : List α) (h : List.Nodup (x :: y :: xs)) :
    (List.formPerm (x :: y :: xs)) x = y
    theorem List.formPerm_apply_nthLe_zero {α : Type u_1} [DecidableEq α] (l : List α) (h : List.Nodup l) (hl : 1 < List.length l) :
    (List.formPerm l) (List.nthLe l 0 ) = List.nthLe l 1 hl
    theorem List.formPerm_eq_head_iff_eq_getLast {α : Type u_1} [DecidableEq α] (l : List α) (x : α) (y : α) :
    (List.formPerm (y :: l)) x = y x = List.getLast (y :: l)
    theorem List.formPerm_apply_lt {α : Type u_1} [DecidableEq α] (xs : List α) (h : List.Nodup xs) (n : ) (hn : n + 1 < List.length xs) :
    (List.formPerm xs) (List.nthLe xs n ) = List.nthLe xs (n + 1) hn
    @[deprecated List.formPerm_apply_get]
    theorem List.formPerm_apply_nthLe {α : Type u_1} [DecidableEq α] (xs : List α) (h : List.Nodup xs) (n : ) (hn : n < List.length xs) :
    (List.formPerm xs) (List.nthLe xs n hn) = List.nthLe xs ((n + 1) % List.length xs)
    theorem List.formPerm_apply_get {α : Type u_1} [DecidableEq α] (xs : List α) (h : List.Nodup xs) (n : ) (hn : n < List.length xs) :
    (List.formPerm xs) (List.get xs { val := n, isLt := hn }) = List.get xs { val := (n + 1) % List.length xs, isLt := }
    theorem List.support_formPerm_of_nodup' {α : Type u_1} [DecidableEq α] (l : List α) (h : List.Nodup l) (h' : ∀ (x : α), l [x]) :
    {x : α | (List.formPerm l) x x} = (List.toFinset l)
    theorem List.support_formPerm_of_nodup {α : Type u_1} [DecidableEq α] [Fintype α] (l : List α) (h : List.Nodup l) (h' : ∀ (x : α), l [x]) :
    theorem List.formPerm_rotate {α : Type u_1} [DecidableEq α] (l : List α) (h : List.Nodup l) (n : ) :
    theorem List.formPerm_eq_of_isRotated {α : Type u_1} [DecidableEq α] {l : List α} {l' : List α} (hd : List.Nodup l) (h : l ~r l') :
    theorem List.formPerm_append_pair {α : Type u_1} [DecidableEq α] (l : List α) (a : α) (b : α) :
    List.formPerm (l ++ [a, b]) = List.formPerm (l ++ [a]) * Equiv.swap a b
    theorem List.formPerm_pow_apply_get {α : Type u_1} [DecidableEq α] (l : List α) (h : List.Nodup l) (n : ) (k : ) (hk : k < List.length l) :
    (List.formPerm l ^ n) (List.get l { val := k, isLt := hk }) = List.get l { val := (k + n) % List.length l, isLt := }
    @[deprecated List.formPerm_pow_apply_get]
    theorem List.formPerm_pow_apply_nthLe {α : Type u_1} [DecidableEq α] (l : List α) (h : List.Nodup l) (n : ) (k : ) (hk : k < List.length l) :
    (List.formPerm l ^ n) (List.nthLe l k hk) = List.nthLe l ((k + n) % List.length l)
    theorem List.formPerm_pow_apply_head {α : Type u_1} [DecidableEq α] (x : α) (l : List α) (h : List.Nodup (x :: l)) (n : ) :
    (List.formPerm (x :: l) ^ n) x = List.get (x :: l) { val := n % List.length (x :: l), isLt := }
    theorem List.formPerm_ext_iff {α : Type u_1} [DecidableEq α] {x : α} {y : α} {x' : α} {y' : α} {l : List α} {l' : List α} (hd : List.Nodup (x :: y :: l)) (hd' : List.Nodup (x' :: y' :: l')) :
    List.formPerm (x :: y :: l) = List.formPerm (x' :: y' :: l') (x :: y :: l) ~r (x' :: y' :: l')
    theorem List.formPerm_apply_mem_eq_self_iff {α : Type u_1} [DecidableEq α] (l : List α) (hl : List.Nodup l) (x : α) (hx : x l) :
    theorem List.formPerm_apply_mem_ne_self_iff {α : Type u_1} [DecidableEq α] (l : List α) (hl : List.Nodup l) (x : α) (hx : x l) :
    theorem List.mem_of_formPerm_ne_self {α : Type u_1} [DecidableEq α] (l : List α) (x : α) (h : (List.formPerm l) x x) :
    x l
    theorem List.formPerm_eq_self_of_not_mem {α : Type u_1} [DecidableEq α] (l : List α) (x : α) (h : xl) :
    theorem List.formPerm_eq_one_iff {α : Type u_1} [DecidableEq α] (l : List α) (hl : List.Nodup l) :
    theorem List.formPerm_eq_formPerm_iff {α : Type u_1} [DecidableEq α] {l : List α} {l' : List α} (hl : List.Nodup l) (hl' : List.Nodup l') :
    theorem List.form_perm_zpow_apply_mem_imp_mem {α : Type u_1} [DecidableEq α] (l : List α) (x : α) (hx : x l) (n : ) :
    (List.formPerm l ^ n) x l