Knapsack is in NP #
The Σ₁ definition of DescriptiveComplexity.Knapsack. Verifying that a set of
binary weights sums to the target is the one place in the catalog where the
certificate has to carry arithmetic: the guess is
sel, the chosen items;psum i p, the bits of the running total over the chosen items up toi;carry i p, the carries of the addition that appendsito that total,
and the kernel checks, first-order, that each step is a ripple-carry addition
– every bit the exclusive or of the three inputs, every carry their majority –
with no carry into the lowest position and none out of the highest. That the
chain really computes the sum is DescriptiveComplexity.binNum_ripple, and that a
chain exists whenever the sum fits is DescriptiveComplexity.exists_ripple
(DescriptiveComplexity.Numbers.BinRel).
Walking the items in order is what makes a single relation psum enough, and
it is why the vocabulary orders the items and not only the bit positions.
The tgt symbol over the sum.
Instances For
Dependency graph
The single existential block of the Σ₁ definition of Knapsack: the
chosen items (unary), the running partial sums and the carries (binary, an
item and a bit position).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dependency graph
The relation variables of the block.
- sel : KnapsackGuessBlockIx
The chosen items.
- pS : KnapsackGuessBlockIx
The running partial sums:
pS i pis the bitpof the total up to the itemi. - carry : KnapsackGuessBlockIx
The carries of the step appending an item.
Instances For
Dependency graph
The bit symbol over the sum.
Instances For
Dependency graph
Dependency graph
The posn symbol over the sum.
Instances For
Dependency graph
Dependency graph
Dependency graph
The item symbol over the sum.
Instances For
Dependency graph
Dependency graph
The le symbol over the sum.
Instances For
Dependency graph
Dependency graph
Equations
- One or more equations did not get rendered due to their size.
Dependency graph
The vocabulary of the kernel: the instance expanded by the block.
Equations
Instances For
Dependency graph
Formula builders #
x is an item, as a formula.
Equations
Instances For
Dependency graph
x is a bit position, as a formula.
Equations
Instances For
Dependency graph
The weight of i has bit 1 at p, as a formula.
Equations
Instances For
Dependency graph
The target has bit 1 at p, as a formula.
Equations
Instances For
Dependency graph
x ≤ y, as a formula.
Equations
Instances For
Dependency graph
x is chosen, as a formula.
Equations
Instances For
Dependency graph
Bit p of the running total at i, as a formula.
Equations
Instances For
Dependency graph
The carry at p of the step appending i, as a formula.
Equations
Instances For
Dependency graph
x = y, as a formula.
Equations
Instances For
Dependency graph
The bit that the item i contributes at p: its weight's bit, if it is
chosen.
Equations
Instances For
Dependency graph
The exclusive or of three formulas, as x ↔ (y ↔ z).
Equations
- DescriptiveComplexity.kXor3F x y z = x.iff (y.iff z)
Instances For
Dependency graph
The majority of three formulas.
Equations
- DescriptiveComplexity.kMaj3F x y z = x ⊓ y ⊔ (x ⊓ z ⊔ y ⊓ z)
Instances For
Dependency graph
i is the first item, as a formula.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
i is the last item, as a formula.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
j is the item right after i, as a formula.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
p is the lowest position, as a formula.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
p is the highest position, as a formula.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
q is the position right above p, as a formula.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The clauses #
The first-order kernel of the Σ₁ definition of Knapsack.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Realization #
Membership #
Knapsack is Σ₁-definable: guess the chosen items, the running totals
and the carries, and check first-order that each step is a ripple-carry
addition whose last total is the target. Since NP is defined as
Σ₁-definability, this is the membership half of the NP-completeness of
Knapsack.