#Knapsack: counting the solutions of a subset-sum instance #
The counting version of DescriptiveComplexity.Knapsack: the number of sets of items
whose binary weights sum exactly to the target
(DescriptiveComplexity.KnapsackSol).
Membership in #P (DescriptiveComplexity.sharpKnapsack_mem_sharpP) is where a
counting definition differs from a Σ₁ one. The certificate of
DescriptiveComplexity.knapsack_sigmaSODefinable carries, besides the chosen items,
the running totals and the carries of an addition walk, and a count of
certificates is a count of solutions only if a solution has one: the totals
and carries are forced where the walk reads them
(DescriptiveComplexity.isChain_agree), and the counting kernel
(DescriptiveComplexity.sharpKnapsackKernel) forbids them anywhere else. The
certificates are then the solutions, bijectively
(DescriptiveComplexity.knapsackEquiv).
The set S of items is a solution: the instance is finite, its order is
linear, and the weights of S sum exactly to the target.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The certificate built on a walk: the chosen items, and the totals and carries of the walk kept only where a walk reads them.
Equations
- One or more equations did not get rendered due to their size.
- DescriptiveComplexity.certOfWalk S PS Cy DescriptiveComplexity.KnapsackGuessBlockIx.sel = fun (w : Fin 1 → A) => S (w 0)
Instances For
Dependency graph
A solution has a certificate.
Dependency graph
The chosen items of a certificate are a solution.
Dependency graph
The solutions of a subset-sum instance are the witnesses of the counting kernel, bijectively: a solution has exactly one certificate.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
#Knapsack: the number of sets of items whose weights sum exactly to the target.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The support of #Knapsack is Knapsack.
Registered in the Lax archive as
Lax280166.KnapsackComplete.sharpKnapsack_support_iff.
Dependency graph
#Knapsack is in #P: a solution has exactly one certificate of the
counting kernel.