Computing the packing of Lemma D.3 in polynomial time #
Cslib.PacketPacking.packing packs the edges of a bipartite multigraph into packets (Lemma D.3 of
[OAI26k], §D.4.2, pp. 58–59). This file computes it natively, on vertices and edges
numbered by natural numbers, and proves that the result is exactly packing
(nativePacking_eq), so Lemma D.3 (1) and (3), numPackets_packing_mul_le and the 2M / r
port bounds row_ports_packing_le and col_ports_packing_le, hold for the native output.
Labels. labelPass runs the conditional-expectation pass of partialLabels over the rows,
then the columns. For each slot it streams the r ^ a candidates in radix order with
Cslib.BalancedSchedules.streamBestSlotLabel, the selector of Lemma 4.5, scoring them by the
cleared incidence potential alone: the group term vanishes for zero variables
(clearedJointScore_zero_one). The candidate count is capped (cappedLength): when
r ^ a ≤ M, for M the number of edges, the selector streams all candidates, and otherwise it
streams one empty word. So every step runs in polynomial time, and under r ^ a ≤ M, which
(D.6) implies (pow_le_card_of_packing), the pass is exactly partialLabels (labelPass_eq).
Packets. packingOfWords follows Packing.ofLabels: it numbers the edges within their
classes (classIndices), takes the largest class (maxLoadOf) and the number of packets
(numPacketsOf), and gives each edge its packet (packetOf) and slot (slotOf) by the
arithmetic of packetEquiv and BitString.equivFin. packetSymbols decodes the symbols of a
packet. These are exact for any labels (packingOfWords_eq, packetSymbols_eq).
Inputs. The numbers of rows and columns and the label length are in unary, the alphabet size
and the (row, column) edges in binary (encPackingInput). The bound r ^ a ≤ M is not
checked: without it the native output is still computed in polynomial time, but it need not be
packing.
Main definitions #
Cslib.PacketPacking.cappedLength: the label length streamed by the selector.Cslib.PacketPacking.bestLabel,Cslib.PacketPacking.labelStep,Cslib.PacketPacking.labelPass,Cslib.PacketPacking.labelWords: one selection, one step, the pass and the row and column words.Cslib.PacketPacking.packingOfWords,Cslib.PacketPacking.nativePacking: the packets and slots for given words, and the whole packing.Cslib.PacketPacking.packetSymbols: the symbols of a packet.Cslib.PacketPacking.edgeList,Cslib.PacketPacking.encPackingInput: the edges of aFinmultigraph as a list, and the input encoding.
Main results #
Cslib.PacketPacking.labelPass_eq,Cslib.PacketPacking.labelWords_eq: the pass computespartialLabels, and the words arerowLabelsandcolLabels.Cslib.PacketPacking.packingOfWords_eq,Cslib.PacketPacking.packetSymbols_eq: the packets, slots and symbols ofPacking.ofLabels.Cslib.PacketPacking.nativePacking_eq: the native packing ispacking.Cslib.PacketPacking.computableInPolyTime_labelWords,Cslib.PacketPacking.computableInPolyTime_packingOfWords,Cslib.PacketPacking.computableInPolyTime_nativePacking,Cslib.PacketPacking.computableInPolyTime_packetSymbols: polynomial time.
References #
- [OAI26k], Appendix D.4.2, Lemma D.3 and its proof, pp. 58–59.
The label pass #
Partial row and column words, none where no label is fixed yet.
The parameters of the pass: (a, r) and the incidences (column, row).
The label length that the selector streams: a when r ^ a ≤ m, so that there are at most
m candidates, and 0 otherwise.
The label of a slot chosen by the conditional expectation of the incidence potential:
streamBestSlotLabel with no group term (zero variables) and unit weight, over the capped label
length.
One step of the pass: a slot without a word gets bestLabel.
The label pass on nR rows and nC columns, with the edges given as (row, column)
pairs.
Correctness #
The words [r]^a with digits in base r, in the radix order of the selector.
The enumeration of Fin n lists 0, …, n - 1.
With zero variables and unit weight, the joint score of the selector is the cleared incidence
potential scaled by r, so it orders the candidates as partialIncidencePotential does.
One step of the pass is one step of greedyLabelPassBy for the incidence potential,
when r ^ a ≤ m.
The words are rowLabels and colLabels when r ^ a ≤ m.
Polynomial time #
The parameters ((a, r), incidences) of the pass: a in unary, r and the incidences in
binary.
The inputs ((nR, nC, a), (r, edges)) of the packing: the numbers of rows and columns and the
label length a in unary, the alphabet size r and the (row, column) edges in binary.
The encoding of PackingInput.
bestLabel is polynomial-time: the capped selector streams at most m + 1 candidates.
One step of the pass is polynomial-time.
The label pass is polynomial-time.
The row and column words are polynomial-time.
Packets and slots #
The largest class size: one more than the largest class number, or zero without edges.
The packet of an edge with row word ρ, column word κ and class number c: its block
c / 2 ^ a, and in each coordinate the sorted pair of symbols, swapped when digit i of c is
1, numbered as Cslib.PacketPacking.packetEquiv numbers them.
The packing for given words is Packing.ofLabels.
The symbols of a packet are those of Packing.ofLabels.
The native packing is the packing of Lemma D.3 when r ^ a ≤ m, which (D.6) implies
(pow_le_card_of_packing): the words of rowLabels and colLabels, the number of packets, and
the packet and slot of each edge. So Lemma D.3 (1) and (3) hold for its output.
Lemma D.3 (1) for the native packing. Under (D.6), 2 Δ D² ≤ M and L D ≤ M, the native
packing has at most 3M / L packets.
Polynomial time of the packets #
The inputs (((a, r), (rowWords, colWords)), edges) of packingOfWords: a in unary and the
rest in binary.
The packing for given words is polynomial-time.
The native packing is polynomial-time. With nativePacking_eq, Lemma D.3's packing is
computable in polynomial time whenever r ^ a is at most the number of edges.
The symbols of a packet are polynomial-time, with a and i in unary.