Partition is NP-hard #
Partition asks for a set of items weighing exactly as much as the items it
leaves out. Karp derives it from Knapsack by padding an instance with the two
weights 2Σ − T and Σ + T; both are arithmetic in the total, so that
padding is not first-order and the reduction has to start elsewhere. It
starts here from NAE-SAT, whose not-all-equal condition is the two-sided
constraint a balanced split imposes.
The gadget #
One digit block per variable and one per clause, in base 2 ^ (3 |A|), and
one item per literal, per slack position and per empty clause:
- the item of the literal
(x, s)has the digit1in the block ofxand in the block of every clause where(x, s)occurs; - the block of a variable therefore totals
2, so a balanced split takes exactly one of the two literals of each variable: it is an assignment; - the item of a slack occurrence – an occurrence of a clause that is
neither its first nor its last – has the digit
1in the block of that clause, which brings the total of a clause of widthwtow + (w − 2); a balanced split takesw − 1of them, that is, between1andw − 1true literals: exactly not-all-equal satisfaction; - a clause with no literal at all totals
1with its own item, an odd digit, so no split exists – which is the right answer, an empty clause being not-all-equal unsatisfiable. A clause of width one needs no item of its own: it has no slack occurrence, so its block already totals1.
Nothing here bounds the width, so the reduction starts from NAE-SAT rather
than from its width-three restriction: w + (w − 2) is even and the interval
[1, w − 1] is the not-all-equal condition at every width.
What the order is for #
Positions are (block, index) pairs ordered lexicographically, one block
being 3 |A| positions, so the lowest position of a block has rank
3 |A| · the rank of the block (DescriptiveComplexity.PartRed.bitRank_pLow) – the
two-level analogue of the block structure of the Knapsack reduction. Only
lowest positions ever carry a bit, so weights are read digit by digit, and
3 |A| bits keep the base above every digit the gadget writes.
The order of the interpreted structure is described once, by a key into
ℕ × A × ℕ × A read lexicographically
(DescriptiveComplexity.PartRed.bwLe_iff), rather than tag pair by tag pair.
The minimum of the order #
A minimum of the order, as a formula over the ordered expansion of the vocabulary of CNF instances.
Instances For
Dependency graph
Dependency graph
The tags #
Tags of the reduction. The items are those of the literals, of the slack
occurrences and of the empty clauses; the positions carry a block – a
variable block (false) or a clause block (true) – and an index inside it,
of which Fin 3 are enough to keep the base above every digit.
- lit
(s : Bool)
: PTag
The item of the literal
(x, s); its tuple is(x, ⊥). - slk
(s : Bool)
: PTag
The item of the slack occurrence
(x, s)ofc; its tuple is(c, x). - emp : PTag
The item of the empty clause
c; its tuple is(c, ⊥). - pos
(k : Bool)
(f : Fin 3)
: PTag
The
f-th position of the block(k, e); its tuple is(e, y).
Instances For
Dependency graph
Equations
- One or more equations did not get rendered due to their size.
- DescriptiveComplexity.PartRed.instDecidableEqPTag.decEq (DescriptiveComplexity.PartRed.PTag.lit a) (DescriptiveComplexity.PartRed.PTag.lit b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- DescriptiveComplexity.PartRed.instDecidableEqPTag.decEq (DescriptiveComplexity.PartRed.PTag.lit s) (DescriptiveComplexity.PartRed.PTag.slk s_1) = isFalse ⋯
- DescriptiveComplexity.PartRed.instDecidableEqPTag.decEq (DescriptiveComplexity.PartRed.PTag.lit s) DescriptiveComplexity.PartRed.PTag.emp = isFalse ⋯
- DescriptiveComplexity.PartRed.instDecidableEqPTag.decEq (DescriptiveComplexity.PartRed.PTag.lit s) (DescriptiveComplexity.PartRed.PTag.pos k f) = isFalse ⋯
- DescriptiveComplexity.PartRed.instDecidableEqPTag.decEq (DescriptiveComplexity.PartRed.PTag.slk s) (DescriptiveComplexity.PartRed.PTag.lit s_1) = isFalse ⋯
- DescriptiveComplexity.PartRed.instDecidableEqPTag.decEq (DescriptiveComplexity.PartRed.PTag.slk a) (DescriptiveComplexity.PartRed.PTag.slk b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- DescriptiveComplexity.PartRed.instDecidableEqPTag.decEq (DescriptiveComplexity.PartRed.PTag.slk s) DescriptiveComplexity.PartRed.PTag.emp = isFalse ⋯
- DescriptiveComplexity.PartRed.instDecidableEqPTag.decEq (DescriptiveComplexity.PartRed.PTag.slk s) (DescriptiveComplexity.PartRed.PTag.pos k f) = isFalse ⋯
- DescriptiveComplexity.PartRed.instDecidableEqPTag.decEq DescriptiveComplexity.PartRed.PTag.emp (DescriptiveComplexity.PartRed.PTag.lit s) = isFalse ⋯
- DescriptiveComplexity.PartRed.instDecidableEqPTag.decEq DescriptiveComplexity.PartRed.PTag.emp (DescriptiveComplexity.PartRed.PTag.slk s) = isFalse ⋯
- DescriptiveComplexity.PartRed.instDecidableEqPTag.decEq DescriptiveComplexity.PartRed.PTag.emp DescriptiveComplexity.PartRed.PTag.emp = isTrue ⋯
- DescriptiveComplexity.PartRed.instDecidableEqPTag.decEq DescriptiveComplexity.PartRed.PTag.emp (DescriptiveComplexity.PartRed.PTag.pos k f) = isFalse ⋯
- DescriptiveComplexity.PartRed.instDecidableEqPTag.decEq (DescriptiveComplexity.PartRed.PTag.pos k f) (DescriptiveComplexity.PartRed.PTag.lit s) = isFalse ⋯
- DescriptiveComplexity.PartRed.instDecidableEqPTag.decEq (DescriptiveComplexity.PartRed.PTag.pos k f) (DescriptiveComplexity.PartRed.PTag.slk s) = isFalse ⋯
- DescriptiveComplexity.PartRed.instDecidableEqPTag.decEq (DescriptiveComplexity.PartRed.PTag.pos k f) DescriptiveComplexity.PartRed.PTag.emp = isFalse ⋯
Instances For
Dependency graph
Dependency graph
Equations
- One or more equations did not get rendered due to their size.
Dependency graph
Dependency graph
The rank of a tag: the items first, then the positions of the variable blocks, then those of the clause blocks. It is the leading component of the key, so it separates items from positions and variable blocks from clause blocks.
Equations
- DescriptiveComplexity.PartRed.tagRk (DescriptiveComplexity.PartRed.PTag.lit false) = 0
- DescriptiveComplexity.PartRed.tagRk (DescriptiveComplexity.PartRed.PTag.lit true) = 1
- DescriptiveComplexity.PartRed.tagRk (DescriptiveComplexity.PartRed.PTag.slk false) = 2
- DescriptiveComplexity.PartRed.tagRk (DescriptiveComplexity.PartRed.PTag.slk true) = 3
- DescriptiveComplexity.PartRed.tagRk DescriptiveComplexity.PartRed.PTag.emp = 4
- DescriptiveComplexity.PartRed.tagRk (DescriptiveComplexity.PartRed.PTag.pos false f) = 5
- DescriptiveComplexity.PartRed.tagRk (DescriptiveComplexity.PartRed.PTag.pos true f) = 6
Instances For
Dependency graph
The rank of a tag inside a block: the index of a position, and 0 for the
items, which no block holds.
Equations
Instances For
Dependency graph
The two ranks together determine the tag.
Dependency graph
The interpretation #
Defining formula for the items: one per literal, one per slack occurrence and one per empty clause.
Equations
- DescriptiveComplexity.PartRed.itemF (DescriptiveComplexity.PartRed.PTag.lit s) = DescriptiveComplexity.PartRed.minF (0, 1)
- DescriptiveComplexity.PartRed.itemF (DescriptiveComplexity.PartRed.PTag.slk s) = DescriptiveComplexity.SatOcc.midF s (0, 0) (0, 1)
- DescriptiveComplexity.PartRed.itemF DescriptiveComplexity.PartRed.PTag.emp = DescriptiveComplexity.SatOcc.emptyClF (0, 0) ⊓ DescriptiveComplexity.PartRed.minF (0, 1)
- DescriptiveComplexity.PartRed.itemF (DescriptiveComplexity.PartRed.PTag.pos k f) = ⊥
Instances For
Dependency graph
Defining formula for the bit positions: every tagged pair is one.
Equations
Instances For
Dependency graph
Defining formula for the bits of the weights. Only the lowest position of
a block – index 0, second coordinate a minimum – ever carries a bit.
Equations
- One or more equations did not get rendered due to their size.
- DescriptiveComplexity.PartRed.bitF x✝¹ x✝ = ⊥
Instances For
Dependency graph
Defining formula for the order: the key (tag rank, first coordinate, index in the block, second coordinate), read lexicographically.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The interpretation of a binary-weighted instance in a CNF structure: one
item per literal, slack occurrence and empty clause, one block of 3 |A|
positions per variable and per clause. The target symbol is unused, Partition
carrying no number to reach.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The points of the interpreted structure #
The point of tag t over the pair w.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Two 2-tuples with the same coordinates are equal.
Dependency graph
The item of the literal (x, s).
Equations
Instances For
Dependency graph
The item of the slack occurrence (x, s) of the clause c.
Equations
Instances For
Dependency graph
The item of the empty clause c.
Equations
Instances For
Dependency graph
The f-th position of the block b.
Equations
Instances For
Dependency graph
The lowest position of the block b.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Characterization of the interpreted relations #
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The key of a point: tag rank, first coordinate, index in the block, second coordinate.
Equations
Instances For
Dependency graph
The order of the interpreted structure, read lexicographically on the keys.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dependency graph
The interpreted order is a linear order: the lexicographic order of the keys, which are pairwise distinct.
Dependency graph
The blocks #
The order of the blocks: the variable blocks first, then the clause blocks, each group in the order of the input.
Equations
- DescriptiveComplexity.PartRed.blkLe = DescriptiveComplexity.lexRel (fun (x1 x2 : Bool) => x1 ≤ x2) fun (x1 x2 : A) => x1 ≤ x2
Instances For
Dependency graph
Dependency graph
Being strictly below a block.
Dependency graph
The rank of a block: how many blocks lie strictly below it.
Equations
Instances For
Dependency graph
The bits, and the lowest position of a block #
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Only the lowest position of a block ever carries a bit.
Dependency graph
The place values #
Dependency graph
The block structure: the rank of the lowest position of a block is
3 |A| times the rank of the block, so its place value is
(2 ^ (3 |A|)) ^ rank – one digit of base 2 ^ (3 |A|) per block.
Dependency graph
Weights, as base-2 ^ (3 |A|) numbers #
The base: one digit per block, 3 |A| bits wide, which is above every
digit the gadget writes, so digits never carry into the next block.
Equations
- DescriptiveComplexity.PartRed.pbase A = 2 ^ (3 * Nat.card A)
Instances For
Dependency graph
Dependency graph
A binary number whose bits sit on the lowest positions of the blocks
selected by sub is the base-2 ^ (3 |A|) number with digit 1 there.
Dependency graph
Every weight is read digit by digit: the digit of a block is 1 when
the item carries a bit at its lowest position, and 0 otherwise.
Dependency graph
The weight of a set of items, read digit by digit: the digit of a block is the number of selected items carrying a bit there.
Dependency graph
Counting the items of a block #
The number of selected items carrying a bit in a block: the digit that block contributes to the weight of the selection.
Equations
Instances For
Dependency graph
Dependency graph
A selection and the items it leaves out split every digit.
Dependency graph
Which items carry a bit in a block #
Dependency graph
The items carrying a bit in a variable block are the two literals of that variable.
Dependency graph
The items carrying a bit in a clause block are the literals occurring in the clause, its slack items, and its own item if it is empty.
Dependency graph
The digits, block by block #
Dependency graph
Dependency graph
Dependency graph
The digit of a variable block counts the selected literals of that variable.
Dependency graph
The digit of a clause block counts the selected literals occurring in the clause, its selected slack items, and its own item if it is empty.
Dependency graph
Every variable block totals two: a balanced split takes exactly one of the two literals of the variable.
Dependency graph
A clause block totals its occurrences plus its slack occurrences, plus one if the clause is empty.
Dependency graph
The digits stay below the base #
Dependency graph
A selection weighs at most as much as all the items, digit by digit.
Dependency graph
No carry: every digit the gadget writes stays below the base, 3 |A|
bits being more than the 4 |A| + 1 items a block can hold.
Dependency graph
The balance condition, digit by digit: a selection weighs as much as the items it leaves out exactly when it takes half of every digit.
Dependency graph
The selection made by an assignment #
The items a not-all-equal assignment selects: the true literals, and the
slack items chosen by M.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The true occurrences of a clause under an assignment.
Equations
- DescriptiveComplexity.PartRed.TrueSet ν c = {p : A × Bool | p ∈ DescriptiveComplexity.SatOcc.OccSet c ∧ DescriptiveComplexity.SatOcc.LitTrue ν p.1 p.2}
Instances For
Dependency graph
Correctness of the reduction #
A balanced split is an assignment: the two literals of a variable split its block, so exactly one of them is selected.
Dependency graph
A balanced split satisfies every clause, not all equal: if no occurrence of a clause were selected, the slack of that clause – strictly fewer items than it has occurrences – would have to make up for all of them, and an empty clause could not be split at all.
Dependency graph
Correctness of the reduction: a CNF structure is not-all-equal satisfiable iff the interpreted binary-weighted instance splits into two halves of equal weight.
Dependency graph
NAE-SAT ordered-FO-reduces to Partition: one item per literal, one per
slack occurrence and one per empty clause; one digit block of 3 |A| bit
positions per variable and per clause. A variable block totals 2, so a
balanced split is an assignment; a clause block of width w totals
w + (w − 2), so a balanced split takes between 1 and w − 1 true
literals, which is not-all-equal satisfaction.
Equations
- One or more equations did not get rendered due to their size.