How Reduction works in proving NP-Hard?

A problem $ X$ is $ NP$ -Hard if for all $ Y \in NP$ , $ Y \leq_P X$ . Further, if a problem $ Z$ is $ NP$ -Complete, and $ Z \leq_P X$ , then I can prove (rather mechanically) that $ X$ is $ NP$ -Hard.

I also found that, for a given X, say TSP, to prove it is $ NP$ -Hard, we often found a Z say $ HAM-CYCLE$ (Hamiltonian-Cycle), and try to show that $ HAM-CYCLE$ can be reduced to a $ TSP$ in polynomial time.

My confusion is, why don’t we try to show that for each instance of $ TSP$ , there exists a corresponding instance of $ HAM-CYCLE$ . Specifically, what if there exists an instance of $ TSP$ , for which there is no corresponding instance in $ HAM-CYCLE$ ! In this case, how can the prior knowledge about the hardness of $ HAM-CYCLE$ help in inferring on TSP’s hardness!

Note: I also had similar concerns with proving $ NP$ -complete class. However, since all $ NPC$ are also $ NP$ , I felt, similar reduction of a known NPC problem to a given problem, say Q, works. However, for $ NP$ -hard case, a given problem X need not to be $ NP$ at all.

Simple hamilton cycle reduction


  • Input: A undirected graph G and 2 nodes s, t

  • Question: Does G contain a hamilton path from s to t?


  • Input: A undirected graph G and a nodes s

  • Question: Does G contain a hamilton cycle starting at s?

I wish to show HAMCYCLE is NP-hard

I’ll show this by doing $ HAMPATH \leq_p HAMCYCLE$ since HAMPATH is known to be NP-COMPLETE

Reduction is as follows

$ (G, s, t) \to (G’, s’)$

where $ s’ = s$ and for $ G’$ I will add one edge from $ t$ to $ s’$

This is polynomial time because we are adding only an edge

if $ (G, s, t) \in HAMPATH$ , then we know there is a hamilton path from s to t, our graph G’ will be $ (s’, \dots, t)$ but since we added a edge from $ t$ to $ s’$ then

$ (s’, \dots, t, s’)$ , a cycle, thus $ (G’,s’) \in HAMCYCLE$

Now doing the converse, if $ (G’, s’) \in HAMCYCLE$ then there exist a hamilton cycle from $ (s’, …, s’)$ that visits every node and comes back to s’ meaning there is a node $ t$ right before $ s$ to make this a hamilton path, thus $ (G, s, t) \in HAMPATH$

Above is my entire attempt. I was wondering if I could call on $ t$ in my reduction since its not used as a input in HAMCYCLE ?

vertex cover reduction to subset sum

subset: input; a multi set $ S$ of numbers and a natural number $ t$ . Question: Does S contain a subset $ A$ such that $ \sum_{x \in A} x = t$ ? (i.e. $ \{1,1,2,3,4,5\}$ , by multiset it means duplicates are allowed)

vertex cover: input: a undirected graph $ G$ and a number $ k$ . Question: Does $ G$ have a vertex cover of size $ k$ ?

Show vertex-cover $ \leq_P$ subset-sum

I need to somehow transform $ (G, k) \to (S, t)$

enter image description here

Above is a example graph $ G$ that I constructed. It’s vertex covers are $ \{v_1, v_3\}$ so the size of the vertex cover is $ 2$ , thus $ k = 2$ .

This is basically $ S$

\begin{array}{|c|c|c|c|c|} \hline & e_1 & e_2 & e_3 & e_4 \ \hline v_1 & 1& 0& 0& 1\ \hline v_2 & 1& 1& 0& 0\ \hline v_3 & 0& 1& 1& 0\ \hline v_4 & 0& 0& 1&1\ \hline \end{array}

if $ e_i$ and $ v_j$ is incident I put $ 1$ ; otherwise $ 0$

Now what I need is a target $ t$ to satisfy this.

The matrix above can be written in a set to be $ S = \{1001, 1100, 0110, 0011\}$ if I were to add up all these values probably in base 2 since its binary, it would give me a value but I think I need a consistent value $ t$ , so this wont work. I’m also unsure how to integrate the $ k = 2$ into this either.

Could someone help me construct this. Thank you

Stock Reduction Multiplier For Variations

I have a customer who is looking at moving to Magento, but one of her major barriers is that we have a custom code programmed for Woocommerce to allow stock to be sold in individual quantities and box quantities using variations.

So for example, she sells a blue glass bottle. You can select a variation of either:

  • Individual items (and multiple using the QTY)
  • Box Quantity (and multiple using the QTY)

When a customer purchases a box variation (of 32 items) the stock will reduce the product inventory by 32.

The reason it is done this way is that she doesnt hold the stock in pre-packaged boxes. Instead if she orders a box quantity she will package them up into a bundle of 32 for shipping. So the stock between individual and box variations are from the same pool.

Does anyone have any idea how this can be achieved in Magento? In wordpress we have a box when adding a variation which is pretty much “Reduce QTY by [ ]” where you can enter “32” so if a box is purchased it reduces stock by 32.

Any help would be greatly appreciated.

Poly-time reduction from ILP to SAT?

So, as is known, ILP’s 0-1 decision problem is NP-complete. Showing it’s in NP is easy, and the original reduction was from SAT; since then, many other NP-Complete problems have been shown to have ILP formulations (which function as reductions from those problems to ILP), because ILP is very usefully general.

Reductions from ILP seem much harder to either do myself or track down.

Thus, my question is, does anyone know a poly-time reduction from ILP to SAT, that is, demonstrating how to solve any 0-1 ILP decision problem using SAT?

Can a Stressful Wish’s Strength Reduction be cured early by a Greater Restoration spell?

Casting a Stressful Wish has dire consequences, including a Strength reduction :

In addition, your Strength drops to 3, if it isn’t 3 or lower already, for 2d4 days. For each of those days that you spend resting and doing nothing more than light activity, your remaining recovery time decreases by 2 days.

The Greater Restoration spell can normally be used to cure an ability score reduction :

You can […] end […] any reduction to one of the target’s Ability Scores

Is the Greater Restoration spell strong enough to undo a Stressful Wish’s Strength reduction early ?

Reduction to proof undecidability of the problem: machine M and N accept infinitely many words

I am struggling with the following problem: Decide whether this problem is decidable or not: For two given Turing Machines M and N, there exists infinitely many words accepted by both machine M and machine N. In other words, is language { encodedMachine(M)#encodedMachine(N) | intersection of language of M and language of N is infinite } decidable?

Intuitively it feels like this is undecidable problem and halting reduction might be used to proof this, but I have no idea how to start this reduction.

Keto Fit Pro Reviews is an powerful weight reduction preference

Keto Fit Pro Reviews is a clearly produced complement and supplies you fast-appearing effects and not using an aspect effect in any respect. This is accomplished via the enormous studies that's done before the formulation of the product. You are able to get a low priced choice for yourself which is going to present you lower starvation ranges, together with a high metabolism. The keto weight loss plan may put positive threat in your fitness in a…

Keto Fit Pro Reviews is an powerful weight reduction preference