Assume problem A with input x
We want to use Reduction from A to B.
What are the steps?
What are the steps in proving a reduction is correct?
Correctness proof structure:
What is the sub-strings problems?
What is the problem B for which the sub-strings problem can be solved using reduction?
Sub-strings problem
Input: a sequence of n words of length 3. W={W1,W2,…,Wn}
Definition: A legal string T for W is a string that satisfies:
Output: is there exists a legal string T for W()
Problem B: “finding an Hamilton path in a directed graph”
What is an Hamilton path and what’s its best run-time Algorithm?
What is an Euler path and what’s its best run-time algorithm?
It is a path which visits every vertex exactly once.
It is NP complete!
Is is a path which visits every edge exactly once.
Best run-time O(|E|+|V|), actually possible in O(|E|)
What is the problem C for which the sub-strings problem can be solved using reduction, where C is not NP-HARD?
What is the input translation?
What is the correctness statement?
What is the helping statement?
Problem C:
Input translation:
Correctness statement:
There is an Euler path for G if and only if there is a legal string T for W.
Proof:
right from the helping statements.
Helping statement 1:
Existence of a legal string T for W implies existence of an Euler path for G
Proof:
Decompose T into (n+1) consecutive words Vi of length 2 by setting Vi to be a word starting at Ti to T(i+1).
Let us look at (Vi|Vi+1). Because T is a legal solution for W, (Vi|V(i+1)) is a word Wi in W.
According to the translation function: there’s an edge in E from Wi to Wi+1, and the path:
P= {W1,W2,..,W(n+1)} is an Euler path. Because they form n unique words in W.
Helping statement 2:
Existence of an Euler path for G implies existence of legal string T for W.
Proof:
Assume an Euler path P={V1,..V(n+1)}
By the input translation function: there’s an edge between Vi and V(i+1), thus Vi|V(i+1) = Wi in W.
Because Vi shares two chars with Vi+1, we can form T= V1|V2|…|Vn which is of size n+1.
Define Euler’s path