Inversions of a map on a finite set #
For a map f : α → β between linear orders and a finite set s ⊆ α, the inversions of f on
s are the pairs a < b of elements of s whose order f reverses, f b < f a. When f is
injective, the parity of their number is the sign of the permutation of s obtained by comparing
the order of s with the order of its image f(s). For a permutation σ of Fin n,
TauCeti.sign_eq_neg_one_pow_card_inversion identifies (-1) ^ #(Finset.univ.inversions σ) with
Equiv.Perm.sign σ.
These signs compare two orderings of the same finite set. In a signed cube totalization the edge
S ⟶ S ∪ {a} carries the sign (-1) ^ #{b ∈ S | b < a}, and reordering the indices of the cube
by f changes these signs by the inversion signs of f on the two vertices of the edge
(Finset.neg_one_pow_card_inversions_insert). Inversion signs are multiplicative under
composition (Finset.neg_one_pow_card_inversions_comp).
Main definitions #
Finset.inversions f s: the pairs(a, b)of elements ofswitha < bandf b < f a.
Main results #
Finset.inversions_univ: on a whole finite type, the inversions are all pairsa < bwithf b < f a.Finset.card_inversions_insert: adjoining a new elementatosadds the inversions involvinga.Finset.card_inversions_insert_add_card_filter_lt: for an injective map, the same comparison ofinsert a swithsas a count of elements, up to an even number.Finset.neg_one_pow_card_inversions_insert: the inversion sign of an injective map oninsert a s, compared with that ons, is the sign relating the position ofainsto the position off ainf(s).Finset.even_card_inversions_comp: the inversion counts offons, ofgonf(s)and ofg ∘ fonsadd up to an even number.Finset.neg_one_pow_card_inversions_comp: the inversion sign ofg ∘ fonsis the product of the inversion signs offonsand ofgonf(s).Finset.card_univ_inversions_eq_comp_succAbove: deleting the entry atkof a tuple removes the inversions involvingk.Finset.neg_one_pow_card_univ_inversions_comp_succAbove: the inversion sign of a tuple compared with the inversion sign of the tuple with its entry atkdeleted.
The inversions of f on s: the pairs (a, b) of elements of s with a < b whose order
f reverses, f b < f a.
Instances For
A monotone map has no inversions.
On the whole of a finite type, the inversions of f are all the pairs a < b with
f b < f a.
The inversions of f on s only depend on the values of f on s.
Exchanging the values at an inversion lowers the inversion count. If (i, j) is an
inversion of f on s, then f ∘ swap i j, which takes the value f j at i and f i at j,
has strictly fewer inversions on s than f.
Adjoining a new element a to s adds the inversions (b, a) with b < a and the
inversions (a, b) with a < b.
For an injective map and a ∉ s, the inversions on insert a s and the elements of s
below a together count the inversions on s and the elements of s whose image lies below
f a, up to an even number.
Reordering signs along an edge. For an injective map f and a ∉ s, the inversion sign
of f on insert a s, times the sign recording the position of a in s, is the inversion sign
of f on s times the sign recording the position of f a in f(s).
The parities of the inversion counts of f on s, of g on f(s) and of g ∘ f on s add
up to zero.
Inversion signs are multiplicative. For an embedding f and an injective map g, the
inversion sign of g ∘ f on s is the product of the inversion signs of f on s and of g on
f(s).
Deleting the entry at k of a tuple b removes the inversions (k, j) and (i, k).
Deleting an entry changes the inversion sign by a position count. The inversion sign of a
tuple b, times the sign recording the earlier entries equal to b k, is the sign recording the
position k and the number of entries smaller than b k, times the inversion sign of the tuple
with its entry at k deleted.