Adding up binary weights along the item order #
The certificate of a binary-weighted problem walks the items in order and
carries the running total: PS i is the total over the chosen items up to
i, and Cy i the carries of the step that appends i. The conditions the
walk must satisfy – every bit the exclusive or of the three inputs, every
carry their majority, no carry into the lowest position, none out of the
highest – are DescriptiveComplexity.IsChain, and this file proves the two
statements the Σ₁ definitions need:
DescriptiveComplexity.chain_sound: a walk really does compute the running totals, so at the last item it computes the total;DescriptiveComplexity.exists_chain: whenever the total fits in the positions, a walk exists – the certificate a yes-instance offers.
Nothing here mentions a vocabulary: the items, their order and the bit positions are all parameters, because the clients need different ones.
- Knapsack walks the instance's own positions, its running totals being bounded by the target, which is written there;
- Partition cannot – each half is
total / 2, which may exceed every number the instance can write – so it walks the wider positions ofDescriptiveComplexity.Numbers.Wide; - 0-1 integer programming walks the same positions as Knapsack but needs one walk per row, so its guessed relations carry a row argument and each slice is a walk of its own.
Partial sums along the item order #
Walks along the item order #
The bit that an item contributes at a position: its own bit, if chosen.
Equations
- DescriptiveComplexity.ChainAdd S wt i p = (S i ∧ wt i p)
Instances For
A ripple-carry walk along the items: PS i is the running total up to
i and Cy i the carries of the step appending i.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A walk computes the running totals.
A walk exists whenever the total fits in the positions: this is the certificate a yes-instance offers.