Drop the subtour elimination constraints, retaining the one-incoming/one-outgoing equations and any branch decisions. This is an assignment problem, solvable in polynomial time. Its optimum is a lower bound on the best schedule in that branch because every admissible schedule satisfies the relaxed constraints. Add the constant processing-time sum to compare completion-time bounds.
Keep a feasible schedule as an incumbent upper bound. At each branch and bound node, solve the restricted assignment problem. If it is infeasible or its bound is at least the incumbent, discard the node. If its optimum is a single tour, it is a feasible schedule attaining the bound, so update the incumbent and close the node. If it has a proper subtour with arcs , every valid Hamiltonian tour must omit at least one of those arcs.
For a disjoint exhaustive branching rule, child forces and forbids , for . Every valid tour falls into the child indexed by the first omitted arc. Re-solve the corresponding assignment relaxations, prioritize small bounds, and repeat. Finitely many binary choices give an exact terminating search; its worst-case tree can be exponential. Assignment optima provide lower bounds, while complete tours provide upper bounds. Patching subtours or local improvement can improve the incumbent without changing the exact pruning argument.
Assume and the integer coefficient bound . There are integers to record. Each signed integer in can be encoded in bits, so a fixed-width dense encoding needs
bits, including the dimensions and bound. Its size is . This is the bit-input model used for polynomial time; an arithmetic-operation count alone would not suffice.
We first construct a rational feasibility certificate for integer inequalities. Choose a feasible point and an orthant containing it, adding coordinate inequalities of the form or . The intersection is nonempty. Starting at a point of , if the active constraint normals have rank less than , choose a nonzero direction annihilating them. A sufficiently short move in either direction remains feasible, since every inactive constraint has positive slack. At least one direction has a finite endpoint: a nonzero coordinate of can be oriented toward the orthant boundary. Move to the first constraint met along such a direction. Its normal does not annihilate , so it is independent of the previously active normals. Their rank strictly increases. In at most moves we obtain a point with independent active constraints.
At that point for an invertible integer matrix . Its rows are original constraint rows or signed coordinate rows, and has entries from or zero. All entries have absolute value at most . By Cramer's rule,
where replaces column by . The Hadamard determinant inequality bounds both determinants by . The denominator is a nonzero integer. Hence each coordinate has the claimed representation with numerator and denominator bounded in absolute value by . The orthant argument is needed because itself may contain lines and have no vertex. If is allowed literally, all coefficients and right sides vanish, and is feasible; the printed fraction bound then needs replaced by , since a nonzero denominator cannot have absolute value at most zero. The bound just proved uses the customary positive coefficient bound.
Recording such fractions takes bits. A verifier checks that denominators are nonzero, changes their signs if needed, and verifies all inequalities by exact integer arithmetic after multiplying by positive denominators. The intermediate integers still have polynomial bit length. Thus a yes-instance has a polynomial-size, polynomial-time verifiable witness, and .
For optimization, let be rational with a finite binary encoding; clear its denominators to make it integer, which multiplies the objective by a positive constant and preserves its minimizers. All bit bounds below include the encoding length of . Let and .
A useful refinement of the preceding vertex argument is that if an objective is bounded below, a feasible point can be moved to an orthant vertex without increasing its objective. Choose the annihilating direction to have . If the inequality is strict, the forward feasible interval must have a finite endpoint, since otherwise the objective would be unbounded below. If , choose either finite endpoint supplied by the orthant. Rank increases as before. There are only finitely many such vertices across the finitely many orthants. Every feasible point therefore has one of these vertices with no larger objective; taking the least vertex value proves that a finite optimum is attained at one of them.
The Cramer representations at this optimum have one common denominator , of magnitude at most . Therefore its objective value has a representation with denominator at most and numerator at most . In particular . No enumeration of orthants or vertices is part of the algorithm; they provide only polynomial-bit bounds.
Here is an exact linear optimization from a feasibility oracle. First call the assumed ellipsoid method feasibility routine on ; if it is empty, report infeasibility. Otherwise query feasibility with the extra inequality . A yes answer proves unboundedness below, because any finite optimum would be at least ; an unbounded objective necessarily gives a yes answer. Thus the infeasible, unbounded and finite-optimum cases are distinguished using two feasibility calls.
In the finite case, maintain an infeasible lower threshold and a feasible upper threshold . Bisect the interval, querying each time. After polynomially many calls its length is less than , and lies in the resulting interval. Distinct reduced fractions with positive denominators at most differ by at least , so there is only one possible value. It can be recovered in polynomial time by continued fractions: for the midpoint , , where is the denominator of . Thus occurs among the continued-fraction convergents of . Compute those by the Euclidean algorithm and choose the unique fraction with denominator at most in the interval. If , use the final exact convergent. The Euclidean algorithm and all thresholds have polynomial bit length.
Even if the feasibility routine returns only a decision, an optimal point can be recovered without assuming a witness-producing oracle. Add and for all . This bounded optimal convex polytope is nonempty, since the optimal vertex above lies in it. Clear the denominator of and set
All vertex coordinates of this fixed convex polytope have denominators at most by the same determinant argument. Minimize , recover its exact minimum by feasibility bisection and rational reconstruction, then fix it; do the same for , and so on. Each restriction is an optimal face of the same original bounded convex polytope, so its vertices are original vertices. The single denominator bound therefore works at every step; repeated new precision bounds do not grow exponentially. After steps all coordinates are fixed to a feasible optimizer. There are polynomially many calls on polynomial-length rational instances, converted to integer inequalities by clearing denominators. Consequently linear optimization has a polynomial-time algorithm whenever linear feasibility does, with exact optimal value and optimizer, and correct reports of infeasibility or unboundedness.
The dual linear program is the minimization problem
Indeed, for the optimization Lagrangian bounds the primal objective above on its feasible points. Its supremum over is finite precisely when , and then equals . The two labelled parts below establish the relevant weak duality and strong duality conclusions.
For the subsequent infeasibility argument, introduce nonnegative slack variables and the convex cone
This is generated by the columns of and the coordinate vectors. Here is why this finitely generated cone is closed. Any representation with a minimal number of positive coefficients uses linearly independent generators: otherwise subtract a suitable multiple of a dependence until one positive coefficient vanishes, preserving nonnegativity. For each fixed independent selection of generators, its nonnegative combinations form a closed set, because the inverse coordinate map on its span is continuous. There are finitely many selections, so their union is closed. This is the closedness of finitely generated cones used in Farkas' lemma.
When the primal linear program is infeasible, . Let be the nearest point of to , and set . The minimizing property gives for every . Taking gives . Consequently
In particular and . Rescaling by the positive number produces the requested Farkas' lemma certificate:
Now a feasible point of the relaxed inequalities would satisfy
Since , the sum of the nonnegative is positive. Thus robust infeasibility under uniform constraint relaxation gives
The ellipsoid method makes progress by reducing the volume of a containing ellipsoid. A nonempty linear polyhedron may have empty interior, so small volume alone cannot certify that the original system is infeasible. Relaxing the inequalities remedies this difficulty, but must not make an infeasible system appear feasible. The displayed positive gap proves exactly that sufficiently small relaxations preserve infeasibility. For rational input, determinant bounds give a Farkas' lemma certificate of polynomial encoding length, so a sufficiently small rational relaxation can be chosen from the input encoding length. Together with a bounding box and bounds on the volume of a relaxed feasible system, this lets the ellipsoid method distinguish infeasibility from a feasible system of very small or zero original volume in polynomial time. The certificate argument alone does not assert a polynomial precision bound for arbitrary unencoded real coefficients.
Use a complete directed graph on cities, with integral arc costs and a threshold . A symmetric cost matrix also represents the undirected travelling salesman problem by orienting a tour. Let the binary variable indicate that city follows city , and forbid self-arcs. The decision integer programming formulation asks whether the following system has a solution:
The in-degree and out-degree equations make the selected arcs a cycle cover of a directed graph. Any proper graph cycle on a city set would violate its subset inequality, so the selected arcs form one Hamiltonian cycle. Conversely, a Hamiltonian cycle obeys every inequality: a proper subset cannot contain all the successor arcs of its graph vertices. Thus the binary feasibility system is equivalent to the decision travelling salesman problem. The subset formulation has exponentially many inequalities, which is harmless for this formulation; verifying a proposed tour does not require listing them.
To call this decision problem NP-complete means two separate things. It belongs to NP: a yes-instance has a polynomial-length certificate in computational complexity, namely the cyclic ordering of the cities, and a deterministic algorithm checks distinct visits, the return to the start, and the total cost in polynomial time in the binary input length. It is also NP-hard: every decision problem in NP has a polynomial-time many-one reduction to it, preserving yes and no answers. This is a statement about worst-case computation on finite encodings, not a proof that every individual tour is hard to find or that no polynomial algorithm exists; that last conclusion would require .
For the strict-threshold decision Max-TSP, choose an integer and replace each arc cost by . Every tour uses exactly arcs, so
Set the new threshold to . Its encoding length, the transformed matrix's encoding length and the computation time are all polynomial in the original input length. If thresholds are required to be nonnegative, take ; the same identity works. Symmetry of costs is preserved. This is a polynomial-time many-one reduction from decision travelling salesman problem to decision Max-TSP, so the latter is NP-hard. A tour is again a polynomially verifiable certificate in computational complexity, now checking strict excess over , so
For the approximation algorithm, use the standard nonnegative-length setting on a complete graph; no triangle inequality is required. Solve the maximum-weight assignment problem with diagonal assignments forbidden, for example by applying the Hungarian algorithm to the negative weights. The resulting cycle cover of a directed graph has weight with , since every tour is an allowed assignment.
If it already has a single graph cycle, it is an optimal tour. Otherwise remove a least-weight arc from each graph cycle. A graph cycle of arcs and weight loses at most . The remaining arcs form vertex-disjoint graph paths covering all cities. Join the endpoint of each graph path to the start of the next, cyclically. The required arcs exist by completeness, and their nonnegative weights cannot diminish the retained weight. The resulting single Hamiltonian cycle therefore satisfies
The Hungarian algorithm takes arithmetic operations, and finding the graph cycles, cutting them and patching the graph paths takes further operations. For rational or integer weights these operations have polynomial encoding length, giving polynomial time. With symmetric costs, the same directed construction is a valid undirected tour after forgetting its orientation. This is the cycle-cover patching half-approximation for Max-TSP.
Nonnegativity is essential to this multiplicative guarantee. If arbitrary signed weights were allowed, giving every arc cost would make every tour have weight , while half the optimum is . No tour could achieve the requested bound. Thus “length” has its usual nonnegative meaning in the approximation assertion.
Introduce nonnegative slack variables and write . A maximizing simplex dictionary is dual feasible when every nonbasic coefficient in the objective is nonpositive. After inserting a constraint, the dual simplex algorithm retains this property while repairing any negative basic value. For a leaving row with , only can enter; choose a column minimizing the ratio of its objective penalty to .
For the first linear program, has the best profit-to-resource ratio. Pivot it into the initial slack basis to obtain
All basic values are nonnegative and all reduced costs are nonpositive, so the optimal point is , with value five. Adding the second constraint gives
The same basis remains feasible and optimal: the second constraint does not change the answer.
The third constraint gives the new row
The current dictionary is dual feasible but primal infeasible. The eligible entering variables are , with dual ratio-test values and respectively. Enter and leave ; solving that row and substituting into the old rows yields
This is a feasible optimal simplex dictionary. Thus the new optimal point is , with value three. As an independent linear programming optimality certificate, dual multipliers have weighted objective bound and weighted coefficient row , which dominates the profit row.
On inserting the fourth constraint the slack is
It has a negative constant and no eligible entering column. Since all its nonbasic variables are nonnegative, this row cannot be satisfied: the fourth linear program is infeasible, and adding the fifth constraint cannot restore feasibility. The requested optimal values are therefore
The arbitrary-data selection question is a maximum feasible subsystem problem. With rational input it is in NP: guess the selected row indices, and test their linear programming feasibility in polynomial time. Equivalently, a nonempty rational polyhedron has a feasible rational point of polynomially bounded encoding length, which serves as a certificate.
For an explicit NP-hardness reduction, take an independent set instance with graph having vertices and desired independent-set size . Use variables , one inequality for each vertex, and identical copies of for each edge. Ask for a feasible subsystem of size . An independent set of size gives such a subsystem: include all edge rows and those vertex rows, and use its indicator vector. Conversely, omitting every copy of even one edge row leaves at most selectable rows. Hence any qualifying subsystem retains every edge inequality and at least vertex inequalities. Their vertices must be independent, since two adjacent selected vertices would force . The construction has polynomial size; is irrelevant to feasibility. Thus the rational-input decision problem is NP-complete, not merely difficult because there are many subsets to enumerate.
A chain of diamond-shaped graph stages has vertices and edges, but distinct source-to-target paths: at each stage choose either of two branches. Each path has its own inequality. Therefore the number of displayed path constraints is not polynomially bounded in the graph size. Redundancy among some inequalities would not change this count of the given formulation.
The positive integer edge costs imply, for any feasible point,
Thus the feasible set lies in the Euclidean ball of radius centered at zero. That ball lies inside , so its volume is at most . This proves the requested enclosing-volume bound, and provides an initial ellipsoid, for example with center zero and shape matrix .
The ellipsoid method needs a separation oracle, rather than an explicit list of every constraint. For a proposed center , first scan the coordinates and the budget inequality. If some , some , or , return the corresponding violated inequality as the separating half-space. These tests take arithmetic operations.
Once those tests pass, assign nonnegative edge length to every edge and solve the shortest path problem from to . The Dijkstra algorithm finds a minimum-length path and stores its predecessors in polynomial time. If its length is less than one, return
for the minimizing path . This inequality contains every feasible point and is violated by . If the shortest length is at least one, every path constraint holds; if no path exists, those constraints are vacuous. In either case is feasible. This is path-constraint separation by shortest paths; checking a single shortest path replaces checking exponentially many paths.
The rational ellipsoid method feasibility theorem now gives polynomial running time in the dimension and coefficient encoding bounds when the oracle runs in polynomial time. Here every path row has coefficients zero or one, and all other coefficients and right sides are bounded integers. Although there are exponentially many rows, their individual encoding lengths are polynomial in . The containing-radius bound and the rational precision bounds are also polynomially describable. For a simple graph , this gives a worst-case running time polynomial in ; in general the natural bound is polynomial in the encoded graph size .
Use the exact rational feasibility version of the ellipsoid method, which handles lower-dimensional polyhedra by rational precision bounds or an appropriate relaxation. Nonemptiness must not be inferred from a positive-volume argument: this feasible set can have empty interior. The allowed algorithmic theorem supplies that detail, while the explicit shortest-path oracle supplies the crucial efficient separation.
The supplied hint interchanges its item and bidder indices in the first-value identity. If the first greedy choice assigns item to bidder , the correct quantity is , and the identity is
Indeed, the eventual bundle of bidder has the form , whose value is ; the other bidders' values are unchanged. Every later marginal contribution for bidder is exactly its marginal in the residual problem, and this is also true for every other bidder. Thus the remainder of the greedy run is the greedy run on , with the same tie choices. The residual values are nonnegative and increasing; they remain submodular set functions as allowed in the question.
We prove the greedy half-approximation for submodular welfare by induction on the number of items. The zero-item case has , so the claimed inequality holds. This base case also handles the fact that the question does not explicitly normalize empty-bundle values to zero.
For the induction step, let
be the first greedy marginal. Since the choice maximizes all available marginals,
Take an optimal allocation and let be the owner of item . If , remove that item from 's bundle and give it to . By submodularity, the loss to its old owner is
Monotonicity makes the recipient's gain nonnegative. The modified allocation, now with assigned to , therefore has value at least . If , no modification is necessary and this bound still holds. Removing and translating bidder 's value by produces a feasible residual allocation, so
Induction applied to that residual problem now gives
Thus the greedy algorithm is a one-half approximation. Empty-bundle constants cause no difficulty because all are nonnegative and .
At each of stages evaluate the marginal for at most bidders and remaining items. This requires value queries, and polynomial additional work with bundle bit-vectors and cached current values. Hence it is a polynomial time approximation algorithm in the value-oracle model, assuming polynomial time bid evaluations. If every bundle bid is explicitly listed, this query bound is polynomial in that larger explicit input as well. The exponentially many possible bundles do not require enumerating allocations.
The PDF's small superscript is essential: . Interpret as the least positive period, the multiplicative order of modulo . If one permitted an unspecified nonminimal period, the answer would not be identifiable; for example, gives the same constant function with period one or period eight. Under the promised periodic modular-exponential interpretation, , so is a unit. Thus
In particular, different residue classes modulo have different function values, which is necessary for the usual quantum period finding coset argument.
Prepare by applying the quantum Fourier transform to the first register. Use repeated squaring to precompute , then multiply the value register by that known number controlled on bit of . These controlled modular multiplications are reversible because is a unit; their inverses use the modular inverses of the same constants. This produces with a polynomial number of the assumed arithmetic operations. Known work registers can be uncomputed.
Measure the value register. Since , its fiber is exactly one coset, and the first register becomes
The quantum Fourier transform of a periodic coset state is supported uniformly on the outcomes , . Indeed the inner geometric series is zero unless , and each allowed amplitude has modulus .
Take two independent Fourier samples and return
This is two-sample exact period recovery. The Chinese remainder theorem makes divisibility of independent uniform residues independent across the different prime divisors of . For each such prime , both and are divisible by with probability . Therefore
The number-theoretic facts used here are the Chinese remainder theorem, the Euler product for the Riemann zeta function at two, and . The candidate can also be certified by : it divides the least period, so this equality holds exactly when it is the full period. Each preparation, reversible evaluation, QFT, measurement and greatest common divisor calculation has the assumed or standard polynomial time cost in . Two runs suffice for the desired constant success probability. Quantum period finding recovers the least period with probability at least in polynomial time.
The Cook-Levin theorem states that the Boolean satisfiability problem is NP-complete under polynomial-time many-one reductions. Membership in NP follows by guessing an assignment and evaluating the formula in time polynomial in its description length.
For hardness, let have a deterministic polynomial-time verifier , with a polynomial witness-length bound. Use a fixed polynomial certificate length: a short certificate is encoded by its length followed by padded data, and the verifier checks this encoding. Pad the computation to exactly steps, with accepting and rejecting states absorbing. Enlarge polynomially if necessary to cover input/witness initialization. A standard polynomial slowdown permits a single-tape Turing machine, so it suffices to handle that model.
Encode a tape cell by a fixed number of bits recording its alphabet symbol and either no head or the head's finite control state. Starting with one head, a cell's next label depends only on its own label and the two neighboring labels: a head can change the symbol where it sits and can enter only a neighbor. Each such finite local function has a constant-size Boolean circuit. The initial row fixes , blanks and the starting head, leaving only the witness bits as Boolean circuit inputs. There are relevant cells with blank margins beyond every possible head position, and updates. Repeating these local Boolean circuits produces a Boolean circuit of size , with an output detecting an accepting head in the final row. The construction is computable in polynomial time. Induction on rows shows that every assignment to produces exactly the verifier's valid computation; invalid local encodings can be assigned arbitrary Boolean circuit behavior because they never arise from the valid initial row.
Convert this Boolean circuit to conjunctive normal form using a Tseitin transformation. Introduce one variable for each wire, and encode each gate output by:
Gate relationClauses imposing equivalence
Unit clauses fix constant sources and assert the final output. Each input assignment has exactly one extension to its gate values, so the resulting formula is satisfiable precisely when some witness makes accept. It has clauses of bounded length and is produced in polynomial time. Thus
This proof also gives hardness for clauses of at most three literals, without needing a separate satisfiability assumption.
A proposed assignment for 2UN-SAT can be checked in polynomial time, including checking the syntactic restriction, so the language belongs to NP.
For an explicit reduction, parse any Boolean formula into a Boolean circuit over binary AND (logical conjunction), binary OR (logical disjunction) and unary NOT (negation), and apply the gate equivalences in part (a), asserting its output. Every gate clause has at most two positive literals: the AND clauses have respectively one, one and one; the OR clauses have one, one and two; and the NOT clauses have two and zero. The unit output/constant clauses also obey the restriction. Hence the resulting formula is an instance of 2UN-SAT.
The Tseitin transformation is linear in the gate description, and its auxiliary variables enforce the gate values rather than relaxing their relation to the inputs. Therefore the original formula is satisfiable if and only if the transformed restricted formula is satisfiable. This is a polynomial-time many-one reduction from SAT, whose hardness follows from the Cook-Levin theorem. Consequently
The condition limits positive literals, without limiting total clause length.
The AND-NOT circuit value problem belongs to P: validate the Boolean circuit and evaluate its gates in a topological ordering. Evaluation takes polynomial time even if its description is not already in a topological ordering.
For P-completeness we use logspace many-one reductions. Start from the supplied circuit value problem over the usual AND (logical conjunction), OR (logical disjunction) and NOT (negation) basis. Retain AND and NOT gates, and replace every OR gate by the De Morgan's laws gadget
This adds only a constant number of gates per old gate, preserves its truth value for all inputs and keeps the Boolean circuit acyclic. If the format includes constant source nodes, replace them by additional input nodes assigned fixed bits zero and one; these are inputs, not disallowed gates. Larger fan-in gates can first be replaced by binary trees of their inputs.
To output the new description, keep the old gate index and a constant-size gadget position, rescan old references when necessary, and assign consistent new indices to each gadget's terminal output. These counters and references occupy bits; the input assignment is copied with any constant-source bits appended. Thus the construction is a logspace many-one reduction preserving acceptance. Since Boolean circuit Value is P-complete under such reductions,
Use the positive-sign quantum Fourier transform
Orthogonality of the finite-group characters makes a unitary operator. Here is the least positive period. The injectivity within one period implies : write , . Periodicity gives , and injectivity forces . Put .
Start with two available computational basis states . Apply to the first register and query the modular-addition quantum oracle:
Measure the second register. For some , the first register becomes the normalized coset state
The quantum Fourier transform of a periodic coset state is
Indeed, the inner geometric sum vanishes unless the Fourier label is a multiple of . Measuring that label gives for a uniformly random . Compute, by the Euclidean algorithm,
Thus exact period recovery from a Fourier sample succeeds whenever is coprime to , and
Here is the Euler totient function. The classical number-theory input is the totient lower bound from the Mertens product: for sufficiently large , for an absolute , with the finitely many small cases handled separately. For recovery is certain; for its probability is . The useful asymptotic probability statement is a lower bound, hence notation; it can be much larger for particular periods, for example a prime period.
There is one oracle query, two Fourier transforms and two measurements. The final greatest common divisor and division use polynomial time in . This meets the specified primitive-operation model without assuming that an arbitrary- Fourier gate is free in another gate model. If a constant success probability is wanted, repeat independently times and return the least common multiple of the candidates: each candidate divides , and one successful sample makes that least common multiple exactly .
Write , and . The easy starting state is uniform over all -bit labels, so its good fraction is , not . For distinct primes one has . If both primes are odd, and , giving . If one prime is two, the other is an odd prime ; since has bits, , and .
The uniform coprime state for a semiprime can now be prepared by one exact Grover rotation. Set
Prepare
Use the good subspace spanned by with and . Its squared overlap with is exactly . The Euclidean algorithm supplies a reversible computation of the membership predicate, including the range check; condition a sign flip on membership and the extra qubit being one, then uncompute the workspace. This implements .
The starting-state reflection uses the inverse of its known preparation and a reflection on the all-zero state. Applying once invokes exact amplitude amplification at , and gives
The extra qubit factors off, and the arithmetic workspace is returned to zero. Although the stated range includes , that label is not coprime to itself, so the predicate is equivalent and avoids admitting labels outside the intended range.
The supplied determine in polynomial time; no factoring procedure is needed. Binary arithmetic, range comparison, the reversible greatest common divisor, the two starting-state reflections and the controlled sign flip all have polynomial-size circuits. Thus the construction takes polynomial time in in the ideal model allowing the specified one-qubit state preparation. Exactness uses the rotation with known amplitudes ; with a fixed finite approximate gate library one obtains arbitrary accuracy with precision overhead, rather than an automatic promise of exact state preparation. In the ideal model the preparation succeeds with certainty, without rejection sampling. If desired, the extra can be reset by a Pauli X gate.
P is the class of decision problems decided by a deterministic algorithm in time polynomial in the encoded input length. NP is the class whose yes-instances have complexity certificates of polynomial length that a deterministic algorithm verifies in polynomial time.
A decision problem is NP-complete if it belongs to NP and is NP-hard: every problem in NP admits a polynomial-time many-one reduction to it. Such a reduction maps an instance to an instance in polynomial time and satisfies is a yes-instance if and only if is a yes-instance. Membership in NP and NP-hardness are both required.