English
A list l defines a permutation by swapping adjacent elements along the list; the overall permutation is the product of these adjacent swaps in order.
Русский
Список l определяет перестановку путём последовательного обмена соседних элементов; итоговая перестановка есть произведение соседних transpositions по порядку.
LaTeX
$$$\\operatorname{formPerm}(l) = \\prod_{i=1}^{|l|-1} \\operatorname{swap}(l_i, l_{i+1})$.$$
Lean4
/-- 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`.
-/
def formPerm : Equiv.Perm α :=
(zipWith Equiv.swap l l.tail).prod