January 13, 2023
Útulek Series, 7 | CF1783F Chapter, 1
1783F asks:
Given two size- permutations, , find the minimum number of operations required to sort both arrays. Each operation sorts some integer into its correct position in both arrays. That is, given , an operation
- Finds s.t. , and swaps ,
- Finds s.t. , and swaps ,
for -indexed .
I’d like to take this problem to investigate further the concept of state space simplification, and gain intuition on the equivalence between seemingly distinct state representations, as well as taking some time to properly learn more advanced flow techniques such as Push-Relabel with LCT, and Goel-Kapralov-Khanna (GKK).
I begin with a series of ideally-reversible simplifications on the problem statement:
Simplification 2 turns out to actually be an equivalence under the objective of minimizing the number of operations. This equivalence is nuanced to prove but easy to intuit. Along with the first simplification, we now ask:
Given size- permutation , find the minimum number of swaps to sort .
This is a fairly well-known problem (see, for example, 1768D). Introductory group theory has what I will call the cycle representation for permutations:
Definition 1.0 (Permutation cycle representation): Permutation where the are disjoint sets of the integers, and
where if (i.e. we define it to wrap around).
In essence, we decompose the permutation into disjoint cycles , where the numbers in each cycle point towards each other in sequence. The cycles are unordered amongst each other, but the numbers within the cycles must be ordered. For example, we have
This has the nice property that, should we define the composition operation between permutations, , the composition may be decomposed into the product of the cycles of and .
Definition 1.1 (Permutation composition): Given permutations , we define with
For example,
Already, we have non-communtativity, as well as the concept of a commutative identity. I think we also have some property with rotating the cycles when we take permutation powers, but I’m having trouble proving that right now. Cycle decomposition should ideally give us permutation periods trivially. Perhaps my definition is flawed by some constant factor…
I want to investigate definition from an information-theoretic view. Naively, permutation representations take objects of information. Cycle representations lik admit cycles, each of which admits some number of elements. Naively, this ends up with objects again, but luckily each cycle must necessarily have as its last element the smallest unseen positive integer, so actually we end up with objects of information in definition .
With a single swap, we can always decrease the size of one cycle by , and create with the element a new singleton. Thus, the minimal number of swaps to sort is always . Intuitively, then, must take at least objects to represent and distinguish from all other size- permutations. I denote this an entropy-optimal representation.
This observation handily solves the simplified 1783F with only considering .
We then take definition on both permutations and end up with cycles which may share some elements. The example I have been using is
for which one of the optimal answers for 1783F is operations of . As expected, we see that each cycle sees or operations, which will reduce all cycles to singletons at the end, thus sorting both arrays.
This naive dual-cycle representation of 1783F is fine, but unlikely to be entropy-optimal. Intuitively, we may only operate on the permutations in unison, so a naive dual-cycle representation must contain extra information which pertains to independent permutation operations.