• Re: On the nature of limitations in commutative processes (1/2)

    From Martin Musatov@21:1/5 to All on Thu Jul 6 08:51:37 2023
    Found it with e search https://www.google.com/search?q=P+and+NP+.+Musatov+sample+problems+_%2Be-e&rlz=1CANCLQ_enUS1065&oq=P+and+NP+.+Musatov+sample+problems+_%2Be-e&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIHCAEQIRigAdIBDjE4MDg4NTc2MWowajE1qAIAsAIA&sourceid=chrome&
    ie=UTF-8&safe=active&ssui=on


    On Thursday, October 22, 2009 at 9:57:47 PM UTC-5, Future_News wrote:
    Number Agreement
    A noun and the words that modify that noun must agree in number. Nouns
    that cannot be counted or divided, such as "oil," "happiness," and "furniture," require singular modifiers.
    Instead of: I found those five money.
    Consider: I found this money.
    Or consider: I found those five pieces of money.

    Instead of: She loved these two pasta.
    Consider: She loved these two types of pasta.
    Or consider: She loved this pasta.
    A Neat Realization
    This is from comp.infosystems and comp.theory on USENET:
    MACHINE PROOFED RESOLUTION TO THE P VERSUS NP PROBLEM PRESENTED BY M.
    MICHAEL MUSATOV WITH A PROMISE TO DONATE ALL $1MM DOLLARS OF THE CLAY
    PRIZE TO CURE CHILDHOOD CANCER WITH HTTP://WWW.ALEXSLEMONADE.ORG/ THE
    P VERSUS NP PROBLEM TWO POSSIBILITIES: 1 OR 2 CHOOSE
    [P =/=NP] AND [P == NP] OR
    [P =/=NP] AND [P == NP] BUT NOT BOTH VERSE THEM EXPLORE THEM ENTWINE
    THEM INT: 2=TPO UNARY 1.=P===NP P=/=NP 2.=P=/=NP P===NP 3.-=P===NP P=/
    =NP 4.=P=/=NP P===NP

    ----------------------------------------------------------------------------------------------------------------------------
    +1.=P===NP P=/=NP
    +2.=P=/=NP P===NP

    ----------------------------------------------------------------------------------------------------------------------------
    +3.-=P===NP P=/=NP

    ----------------------------------------------------------------------------------------------------------------------------
    +4.=P=/=NP P===NP ECHO HELLO WORLD WRITE OUT = 2- : OVER THIS MESSAGE
    AND AFTER THIS MESSAGE ANDE THROUGH THIS MESSEAGE ECHO HOLLA WORLD:
    On Oct 22, 9:03 pm, Future_News <future_n...@brew-master.com wrote:
    On Oct 22, 8:31 pm, Future_News <future_n...@brew-master.com wrote:
    On Oct 22, 4:48 pm, Tegiri Nenashi <tegirinena...@gmail.com wrote:
    On Oct 21, 5:04 pm, cplxphil <cplxp...@gmail.com wrote:
    I'm not sure if you're disagreeing. If you are, my response is that
    you could argue that it preserves the same structure of the decision
    problem, but expressed as a formal language, it's technically
    different. It has to be proven that languages are basically equivalent
    (in terms of decidability, time complexity, and space complexity) and independent of encoding scheme, and this proof only applies to
    encoding schemes that use at least two symbols in the alphabet.
    I'm not comfortable with this alphabet symbols count. Do word
    separators count as alphabet symbols or not? Why is the language is
    assumed to be structured into sentences of words? This looks like ad-
    hoc assumption from language theory perspective.
    I guess something I should have mentioned earlier is that Cook's
    theorem would not be true if you use a unary alphabet, meaning that
    SAT would not be NP-complete in that case. If you think you can prove
    Cook's theorem for a unary alphabet, please share this proof. http://en.wikipedia.org/wiki/Cook%E2%80%93Levin_theorem
    The only place I noticed depending on the encoding appeared to be the
    last sentence. Changing log into polynomial doesn't change anything
    there. Is there another dependency I'm missing?
    NP 3 334 44 NP NPNP-Co -Co-Com mmp pplet letletene eneenes sss ss
    34.1 Polynomial time 34.2 Polynomial-time verification 34.3 NP-
    completeness and reducibility 34.4 NP-completeness proofs 34.5 NP-
    complete problems 34 NP-Completeness
    3 334 44 NP NPNP-Co -Co-Com mmp pplet letletene eneenes sss ss
    ............. polynomial time.... ,.... worst case....... O(nk),.. n .
    input size, k. constant. .. ............ polynomial time..
    Turing.........: Halting problem,.................,.. ... polynomial time...... .............,........ O(nk).
    Generally, we think of problems that are solvable by polynomial-time algorithms as being tractable, and problems that require
    superpolynomial time as being intractable.
    34 NP-Completeness
    3 334 44 NP NPNP-Co -Co-Com mmp pplet letletene eneenes sss ss
    ..... polynomial time.....,... . P......... polynomial
    time... ..........,.. NP....
    . 1971...... P = NP ?...,...
    ............. ....... NP-complete...,... NP .......,...... polynomial
    time ...,............. polynomial time....
    34 NP-Completeness
    3 334 44 NP NPNP-Co -Co-Com mmp pplet letletene eneenes sss ss
    .. NP-complete............ ,.... polynomial time....... .....
    Shortest vs. Longest simple paths: 24.. ........... single source.
    shortest path...... O(VE)..
    longest simple paths....:..... ,........ simple path(.....
    path),...... k........:. ..... Hamiltonian path(......
    path)..........,. NPcomplete ....
    34 NP-Completeness
    3 334 44 NP NPNP-Co -Co-Com mmp pplet letletene eneenes sss ss
    Euler tour vs. Hamiltonian cycle:.... ..,............. cycle,. . Euler tour...,.. O(E)....... .....,.............. cycle,.. Hamiltonian
    cycle...... .....,. NP-complete....
    34 NP-Completeness
    3 334 44 NP NPNP-Co -Co-Com mmp pplet letletene eneenes sss ss
    2-CNF satisfiability vs. 3-CNF satisfiability:
    ........,............ .. true,.. satisfiability....... . .............
    (x1 . -x2) . (-x1
    x3) . (-x2 . -x3)....,.. 2
    CNF(conjuctive normal form) satisfiability
    ... (........ or,......
    ... and,............ );.
    ...............,.. 3-CNF
    satisfiability.... 2-CNFsatisfiability. ..,. 3-CNF satisfiability..... NPcomplete .... 34 NP-Completeness
    3 334 44 NP NPNP-Co -Co-Com mmp pplet letletene eneenes sss ss NP-completeness and the classes P and NP
    ....,.......:..... polynomial time.....,.... P......... polynomial time.............,. . NP...,.. Hamiltonian cycle, 3-CNF. .. P .
    NP,...: P . NP?.......: P..... NP. . NP-complete... NP.......,... . NP- complete...... polynomial time. ....,.. NP....... polynomial time ....
    34 NP-Completeness
    3 334 44 NP NPNP-Co -Co-Com mmp pplet letletene eneenes
    sss
    ss
    .. NP-complete........
    polynomial time....,.......
    .. polynomial time....
    ....,...... P.NP,.. NP-
    complete............,.
    1971. Cook..... NP-complete..
    ..,..................
    NP-complete... polynomial time....
    ..............,......
    .
    34 NP-Completeness
    3
    334
    44 NP
    NPNP-Co
    -Co-Com
    mmp
    pplet
    letletene
    eneenes
    sss
    ss
    ......... NP-complete....
    ...,............ NPcomplete
    .
    P.... NP......;.. NPcomplete
    ....,.....
    approximation algorithm;......
    special case....,.........
    polynomial time..........
    34 NP-Completeness
    3
    334
    44 NP
    NPNP-Co
    -Co-Com
    mmp
    pplet
    letletene
    eneenes
    sss
    ss
    Overview of showing problems to be NP-
    complete
    ....... NP-complete........
    .....,................
    .......;........ NPcomplete
    .................
    ........... O(n lg n)......
    34 NP-Completeness
    3
    334
    44 NP
    NPNP-Co
    -Co-Com
    mmp
    pplet
    letletene
    eneenes
    sss
    ss
    Decision problems vs. Optimization problems
    ...................,.
    ........ (optimization problems),
    ...........: minimum spanning
    tree. shortest path..........
    ..... decision problems,......
    ..,....... (Yes/No)...:...
    . weight..... 20. spanning tree..
    ........ k. simple cycle.
    .... decision.... optimization..
    ......... NP-complete.,...
    decision problem....34 NP-Completeness
    3
    334
    44 NP
    NPNP-Co
    -Co-Com
    mmp
    pplet
    letletene
    eneenes
    sss
    ss
    Decision problems vs. Optimization problems
    . Optimization......... decision
    ........:......... u, v.
    v
    .......... decision...... u,
    .......... k .......,.
    ...........,..........
    ........ k .... decision....
    .,.. decision.........
    optimization......
    .. decision........,.......
    ..,.... polynomial time,....
    decision problem...
    34 NP-Completeness
    3
    334
    44 NP
    NPNP-Co
    -Co-Com
    mmp
    pplet
    letletene
    eneenes
    sss
    ss
    Reduction
    ........... reduction,.....
    ..... A. NP-complete.
    ........ A. polynomial time..
    ......,...... polynomial time
    ...........:..... A....
    (instance)........ polynomial time
    ...... B ... .,.... .....
    ...........,.. A....
    polynomial time...
    1....... polynomial time.
    2. ..... .....34 NP-Completeness
    14
    34 NP-Completeness
    34 NP-Completeness34 NP-Completeness
    Reduction
    We call such a procedure a polynomial-time
    reduction algorithm.
    polynomial-time
    reduction algorithm
    polynomial-time
    algorithm to decide B
    . .
    yes yes
    no no
    Polynomial-time algorithm to decide A
    3
    334
    44 NP
    NPNP-Co
    -Co-Com
    mmp
    pplet
    letletene
    eneenes
    sss
    ss
    Reduction
    ........ NP-complete.......
    ....... polynomial time.....,
    .......... reduction......
    ........ A. NP-complete.....
    . reduction...,......... NPcomplete
    ... B,. polynomial time...
    B. input reduce. A. input,.. A...
    .. B....
    34 NP-Completeness
    3
    334
    44 NP
    NPNP-Co
    -Co-Com
    mmp
    pplet
    letletene
    eneenes
    sss
    ss
    . reduce......,.........
    .. NP-complete.....
    .....:... NP-complete.....
    .......
    ... NP-complete problem. Cook...
    . satisfiability,........ NP...
    reduce. satisfiability......
    satisfiability.... NP-complete
    problem.
    34 NP-Completeness
    3
    334
    44.1
    .1.1 P
    PPo
    ooly
    lylyn
    nno
    oom
    mmia
    iaial
    ll tim
    timtime
    ee
    ....... polynomial time.....
    .. tractable,....:
    1.
    .. polynomial time........
    .....,.. .(n100).......
    ,... polynomial time.......
    .....
    2. Polynomial time...........
    model.... polynomial time...
    ,. RAM.... Turing machine..
    .....
    3. Polynomial time
    ..........
    (closure),..............
    ...34 NP-Completeness
    3
    334
    44.1
    .1.1 P
    PPo
    ooly
    lylyn
    nno
    oom
    mmia
    iaial
    ll tim
    timtime
    ee
    We define an abstract problem Q to be a
    binary relation on a set I of problem
    instances and a set S of problem
    solutions.
    ..: shortest path.........
    G... u... v,... G. u. v
    ............. k. path..
    ....,.... yes..... no,.
    . decision problem....
    Optimization problems.........
    .....,........ decision..
    ....
    34 NP-Completeness
    3
    334
    44.1
    .1.1 P
    PPo
    ooly
    lylyn
    nno
    oom
    mmia
    iaial
    ll tim
    timtime
    ee
    If a computer program is to solve an
    abstract problem, problem instances must
    be represented in a way that the program
    understands. An encoding of a set S of
    abstract objects is a mapping e from S to
    the set of binary strings.
    ...... polygons, graphs, functions,
    ordered pairs, programs..... binary
    strings.
    34 NP-Completeness
    3
    334
    44.1
    .1.1 P
    PPo
    ooly
    lylyn
    nno
    oom
    mmia
    iaial
    ll tim
    timtime
    ee
    A computer algorithm that "solves" come
    abstract decision problem actually takes an
    encoding of a problem instance as input. We
    of call a problem whose instance set is the set
    binary strings a concrete problem. An
    algorithm solves a concrete problem in time
    O(T(n)) if, when it is provided a problem
    instance i of length n = |i|, the algorithm can
    produce the solution in O(T(n)) time. A
    concrete
    problem is polynomial-time
    solvable, therefore, if there exists an
    algorithm to solve it in time O(nk) for some
    constant k.
    34 NP-Completeness
    3
    334
    44.1
    .1.1 P
    PPo
    ooly
    lylyn
    nno
    oom
    mmia
    iaial
    ll tim
    timtime
    ee
    The complexity class P is the set of concrete
    decision problems that are polynomial-time
    solvable.
    ............
    k,. O(k)....
    ...,.............
    ..........,.. unary(...
    ).
    ......,.. O(n)...;... binary
    .......,........ O(2n).
    34 NP-Completeness
    3
    334
    44.1
    .1.1 P
    PPo
    ooly
    lylyn
    nno
    oom
    mmia
    iaial
    ll tim
    timtime
    ee
    We say that a function f: {0,1}* .
    {0,1}* is
    polynomial-time computable if there exists a
    polynomial-time algorithm A that, given any
    that
    input x .
    {0,1}*, produces as output f(x).
    For some set I of problem instances, we say
    two encodings e1 and e2 are
    polynomially related if there exist two
    polynomial-time computable functions f12 and
    ef21 such that for any i .
    I, we have f12(e1(i)) =
    2(i) and f21(e2(i)) = e1(i).
    34 NP-Completeness
    3
    334
    44.1
    .1.1 P
    PPo
    ooly
    lylyn
    nno
    oom
    mmia
    iaial
    ll tim
    timtime
    ee
    Lemma 34.1 Let Q be an abstract decision
    problem on an instance set I, and let e1 and
    e2 be polynomially related encodings on I.
    Then, e1(Q) .
    P if and only if e2(Q) .
    P.
    Proof:... e1(i)...... O(nk)...
    e2(i)... e1(i).... O(nc)....
    e2(i)
    .,.....:... e1(i)... e1(i)...
    ,.... O(nc+k),.. polynomial time..
    ...
    34 NP-Completeness
    24
    34.1 Polynomial time34.1 Polynomial time
    ....... polynomial time......
    ....,........... P....
    .............. binary code,.
    ..............
    34 NP-Completeness
    3
    334
    44.1
    .1.1 P
    PPo
    ooly
    lylyn
    nno
    oom
    mmia
    iaial
    ll tim
    timtime
    ee
    A formal-language framework
    .. formal language....
    decision problem
    An alphabet S
    is a finite set of symbols. A
    language L over S
    is any set of strings made up
    of symbols from S. E.g, if S={0,1}, the set
    L={10,11,101,111,1011, 1101, 10001, ...} is
    the language of binary representations of
    prime numbers.
    empty string ., empty language Ø. The
    language of all strings over S
    is denoted by S*.
    34 NP-Completeness
    26
    3
    334
    44.1
    .1.1 P
    PPo
    ooly
    lylyn
    nno
    oom
    mmia
    iaial
    ll tim
    timtime
    ee
    Languages. operations: union .,
    intersection n, complement L = S* – L,
    concatenation, closure.
    The concatenation of two languages L1 and L2
    isthelanguage L = {xx: x.
    Land x.
    L}.
    1211 22
    The closure or Kleene star of a language L is
    the language L* = {.} .
    L .
    L2 .
    L3 .
    ..., where
    Lk is the language obtained by concatenating
    L to itself k times.
    34 NP-Completeness
    3
    334
    44.1
    .1.1 P
    PPo
    ooly
    lylyn
    nno
    oom
    mmia
    iaial
    ll tim
    timtime
    ee
    From the point of view of language theory,
    the set of instances for any decision problem
    Q is simply the set S*, where S
    = {0,1}. Since
    Q is entirely characterized by those problem
    instances that produce a 1(yes) answer, we
    can view Q as a language L over S
    = {0,1},
    whereL = {x .S* : Q(x) = 1}.
    ..: PATH = {<G,u,v,k
    : G = (V,E) is an
    undirected graph, u, v .
    V, k = 0 is an
    integer, and there exists a path from u to v in
    G consisting of at most k edges}.
    34 NP-Completeness
    3
    334
    44.1
    .1.1 P
    PPo
    ooly
    lylyn
    nno
    oom
    mmia
    iaial
    ll tim
    timtime
    ee
    We say that an algorithm A accepts a string x
    .
    {0,1}* if, given input x, the algorithm's
    output A(x) is 1. The language accepted by
    {0,1}*
    an algorithm A is the set of strings L = {x .
    : A(x) = 1}, that is, the set of strings
    that the algorithm accepts. An algorithm A
    rejects string x if A(x) = 0.
    34 NP-Completeness
    3
    334
    44.1
    .1.1 P
    PPo
    ooly
    lylyn
    nno
    oom
    mmia
    iaial
    ll tim
    timtime
    ee
    A language L is decided by an algorithm A if
    every binary string in L is accepted by A and
    every binary string not in L is rejected by A.
    A language L is accepted in polynomial time
    by an algorithm A if it is accepted by A and if
    in addition there is a constant k such that for
    any length-n string x .
    L, algorithm A accepts
    x in time O(nk).
    A language L is decided in polynomial time
    an algorithm A if there is a constant kby
    such that for any length-n string x .
    {0,1}*,
    the algorithm correctly decides whether x L
    in time O(nk). 34 NP-Completeness
    30
    We define
    languages,
    determined by
    3
    334
    44.1
    .1.1 P
    PPo
    ooly
    lylyn
    nno
    oom
    mmia
    iaial
    ll tim
    timtime
    ee
    a complexity class as a set of
    membership in which is
    a complexity measure, such
    as running time, of an algorithm that
    34 NP-Completeness
    determines whether a given string x belongs
    to language L.
    We can provide an alternative definition of
    the complexity class P: P = {L .{0,1}* :
    there exists an algorithm A that decides L in
    polynomial time}.
    3
    334
    44.1
    .1.1 P
    PPo
    ooly
    lylyn
    nno
    oom
    mmia
    iaial
    ll tim
    timtime
    ee
    In fact, P is also the class of languages that
    can be accepted in polynomial time.
    Theorem 34.2 P = {L: L is accepted by a
    polynomial-time algorithm}.
    34 NP-Completeness
    Ex
    ExExer
    ererc
    ccis
    isise
    ees
    ss 3
    334
    44.1
    .1.1
    for
    34.1-4 Is the dynamic-programming algorithm
    for the 0-1 knapsack problem that is asked
    in Exercise 16.2-2 a polynomial-time
    16.2-2 Give
    algorithm ? Explain your answer.
    a dynamic-programming solution
    to the 0-1 knapsack problem that runs in O(n
    W) time, where n is number of items and W is
    the maximum weight of items that the thief
    can put in his knapsack.
    34 NP-Completeness
    33
    Exercises34.1Exercises 34.1
    34.1-6 Show that the class P, viewed as a set of
    languages, is closed under union,
    intersection, concatenation, complement,
    and Kleene star. That is, if L1, L2 .P, then L1 .
    L2 .P, etc.
    34.1-6 Show that the class P, viewed as a set of
    languages, is closed under union,
    intersection, concatenation, complement,
    and Kleene star. That is, if L1, L2 .P, then L1 .
    L2 .P, etc.
    34 NP-Completeness
    34.234.234.234.2 Po
    PoPol
    lly
    yyno
    nonom
    mmi
    iia
    aal
    ll-
    --ti
    titim
    mme
    ee v
    vve
    eer
    rri
    iif
    ffi
    iic
    cca
    aati
    titio
    oon
    nn
    ... polynomial-time verification...
    ..... polynomial-time.......
    .........,..... PATH..
    .,..... G... u... v,..
    .. k,.... path,..... lineartime
    ....... path... u. v.
    path,......... k,....
    polynomial-time verification.
    ..... polynomial-time......,
    ..... polynomial-time verification.
    ............ polynomial-time
    ...,...... polynomial-time
    verification....34 NP-Completeness
    35
    34.2 Polynomial-time verification34.2 Polynomial-time verification Hamiltonian cycle
    .............. hamiltonian
    cycle,...............
    hamiltonian cycle of an undirectedAgraph G = (V, E) is a simple
    cycle
    that
    contains each vertex in V. A graph that
    contains a hamiltonian cycle is said to be
    hamiltonian; otherwise, it is
    nonhamiltonian.
    Hamiltonian-cycle problem: "Does a graph
    G have a hamiltonian cycle ?"
    34 NP-Completeness
    36
    34.2 Polynomial-time verification34.2 Polynomial-time verification
    .......... hamiltonian-cycle?
    .....
    dodecahedron
    ...... bipartite graph
    34 NP-Completeness
    37
    34.2 Polynomial-time verification34.2 Polynomial-time verification
    . hamiltonian cycle.......
    polynomial time...,.... O(2n).
    Verification algorithms:.....,...
    .......,............
    ....... G. cycle C,.....
    C
    ... hamiltonian cycle........
    cycle,........,........
    ,............ hamiltonian
    cycle,......:..........
    ............ edge?....
    simple cycle?.......... Yes,.
    ... hamiltonian cycle.
    34 NP-Completeness
    38
    34.2 Polynomial-time verification34.2 Polynomial-time verification
    We define a verification algorithm as
    being a two-argument algorithm A, where
    one argument is an ordinary input string x
    certificate.
    and the other is a binary string y called a
    A two-argument algorithm A
    verifies an input string x if there exists a
    certificate y such that A(x, y) = 1. The
    language verified by a verification
    algorithm A is L = {x .
    {0,1}* : there
    exists y .
    {0,1}* such that A(x, y) = 1}.
    34 NP-Completeness
    34.234.234.234.2 Po
    PoPol
    lly
    yyno
    nonom
    mmi
    iia
    aal
    ll-
    --ti
    titim
    mme
    ee v
    vve
    eer
    rri
    iif
    ffi
    iic
    cca
    aati
    titio
    oon
    nn
    The complexity class NP
    ........ polynomial time....,..
    hamiltonian-cycle problem.. NP....
    .... NP. NP. nondeterministic
    model
    polynomial ...,.... non-deterministic
    ..,.. polynomial time......,
    .. NP....
    A language L .
    NP iff there exists a two-input
    polynomial-time algorithm A and constant c such
    that L = {x .
    {0,1}* : there exists a certificate y
    with |y| = O(|x|c) such that A(x, y) = 1}.
    The algorithm A verifies language L in polynomial
    time.
    34 NP-Completeness
    34.234.234.234.2 Po
    PoPol
    lly
    yyno
    nonom
    mmi
    iia
    aal
    ll-
    --ti
    titim
    mme
    ee v
    vve
    eer
    rri
    iif
    ffi
    iic
    cca
    aati
    titio
    oon
    nn
    ..... hamiltonian cycle..... NP.
    ..,..... L ... P... L....
    . NP,.... L .............
    ..,.. P .
    NP.
    ...... P=
    NP........,...
    ........ P . NP.
    34 NP-Completeness
    34.234.234.234.2 Po
    PoPol
    lly
    yyno
    nonom
    mmi
    iia
    aal
    ll-
    --ti
    titim
    mme
    ee v
    vve
    eer
    rri
    iif
    ffi
    iic
    cca
    aati
    titio
    oon
    nn
    .. P.... NP..,..........
    ...,.. NP...... complement.
    ......... L .
    NP..... L .
    NP.
    NPWe can define the complexity class co-NP as
    the set of languages L such that L .
    NP.
    ............ NP.... coNP
    ....
    P = NP = co-NP NP = co-NP
    P
    co-NP NPP = NP nco-NP co-NP NPNP nco-NP
    P
    .......
    34 NP-Completeness
    E
    EEx
    xxe
    eer
    rrc
    cci
    iis
    sse
    ees
    ss 34
    3434.2
    .2.2
    42
    34.2-1 Consider
    ISOMORPHISM
    isomorphic graphs}. Prove that GRAPH-
    ISOMORPHISM .NP by describing a
    polynomial-time algorithm to verify the
    language.
    34.2-2 Prove that if G is an undirected bipartite
    graph with an odd number of vertices, then G
    is nonhamiltonian.
    the language GRAPH={<
    G,G
    :Gand Gare
    121 2
    34 NP-Completeness
    E
    EEx
    xxe
    eer
    rrc
    cci
    iis
    sse
    ees
    ss 34
    3434.2
    .2.2
    34.2-4 Prove that the class NP of languages is
    closed under union, intersection,
    34.2-6
    concatenation, and Kleene star. Discuss the
    closure of NP under complement.
    A hamiltonian path in a graph is a
    simple path that visits every vertex exactly
    once. Show that the language HAM-PATH = {
    <G, u, v
    : there is a hamiltonian path from u
    to v in graph G} belongs to NP.
    34 NP-Completeness
    E
    EEx
    xxe
    eer
    rrc
    cci
    iis
    sse
    ees
    ss 34
    3434.2
    .2.2
    34.2-7 Show that the hamiltonian-path
    problem can be solved in polynomial time on
    34.2-11
    directed acyclic graphs. Give an efficient
    algorithm for the problem.
    Let G be a connected, undirected
    graph with at least 3 vertices, and let G3 be
    the graph obtained by connecting all pairs of
    vertices that are connected by a path in G of
    length
    most 3. Prove that G3 is
    hamiltonian. (Hint: Construct a spanning tree
    at
    for G, and use an inductive argument.)
    34 NP-Completeness
    34.3
    34.334.3 N
    NNP
    PP-
    --c
    cco
    oom
    mmp
    ppl
    lle
    eet
    tte
    een
    nne
    ees
    sss
    ss a
    aand
    ndnd r
    rre
    eed
    dduc
    ucuci
    iib
    bbi
    iil
    lli
    iity
    tyty
    ..... P . NP........ NPcomplete
    ...,.... NP-complete
    ...... polynomial time.....,
    NP....... polynomial time..
    ....,... P = NP.........
    ,..... NP-complete.......
    ..... polynomial time.....
    .. Hamiltonian cycle..... NPcomplete
    ...,..... polynomial
    time.... Hamiltonian cycle...,
    .. NP....... polynomial time
    .....
    34 NP-Completeness
    46
    34.3 NP-completeness and reducibility34.3 NP-completeness and
    reducibility
    ....,.. NP – P.......,..
    Hamiltonian cycle....... NP –
    P.
    .... NP-complete.... NP...
    ...
    ...... polynomial-time reducibility
    ...... NP-complete......
    34 NP-Completeness
    47
    34.3 NP-completeness and reducibility34.3 NP-completeness and
    reducibility
    L1 is polynomial-time reducible to L2,
    written L1 =P L2,.. L2 . P. L1 . P.
    A
    ..: L2. sorting...,. L1....
    ....,. L1 =PL2.
    language L1 is polynomial-time
    reducible to a language L2, written L1 =P
    L2, if there exists a polynomial-time
    computable function f : {0,1}* .
    {0,1}*
    such that for all x .
    {0,1}*, x .
    L1 if and
    only if f(x) .
    L2.
    34 NP-Completeness
    48
    Lemma 34.3 If Lsuch that L
    34.3
    34.334.3 N
    NNP
    PP-
    --c
    cco
    oom
    mmp
    ppl
    lle
    eet
    tte
    een
    nne
    ees
    sss
    ss a
    aand
    ndnd r
    rre
    eed
    dduc
    ucuci
    iib
    bbi
    iil
    lli
    iity
    tyty
    1, L2 .
    {0,1}* are languages
    =L,thenL.
    P implies L.
    1P22 1
    P.
    34 NP-Completeness
    A1
    A2F
    f(x)x
    yes, f(x) .L2
    no, f(x) .L2
    yes, x .L1
    no, x .L1
    49
    34.3 NP-completeness and reducibility34.3 NP-completeness and
    reducibility
    NP-completeness
    Polynomial-time reductions provide a
    formal means for showing that one
    We
    problem is at least as hard as another, to
    within a polynomial-time factor.
    define the set of NP-complete
    languages, which are the hardest
    problems in NP.
    A language L .
    {0,1}* is NP-complete if
    1. L .
    NP, and
    2. L' =P L for every L' .
    NP.
    34 NP-Completeness
    34.3
    34.334.3 N
    NNP
    PP-
    --c
    cco
    oom
    mmp
    ppl
    lle
    eet
    tte
    een
    nne
    ees
    sss
    ss a
    aand
    ndnd r
    rre
    eed
    dduc
    ucuci
    iib
    bbi
    iil
    lli
    iity
    tyty
    . L . NP-complete...,. L . NP,
    ..... NP... L' =P L.
    .......... NP... L' =P L..
    ..., L .. NP-hard....
    .... NPC..
    NP-complete
    languages.
    . L1 =PL2.,.. L1. NP-complete.
    L2.... NP-hard.
    34 NP-Completeness
    51
    34.3 NP-completeness and reducibility34.3 NP-completeness and
    reducibility
    Theorem 34.4 If any NP-complete problem
    is polynomial-time solvable, then P = NP.
    Equivalently, if any problem in NP is not
    complete
    solvable.
    polynomial-time solvable, then no NP-
    problem is polynomial-time
    ...... P .NP
    NP
    P
    NP-Complete
    34 NP-Completeness
    34.3
    34.334.3 N
    NNP
    PP-
    --c
    cco
    oom
    mmp
    ppl
    lle
    eet
    tte
    een
    nne
    ees
    sss
    ss a
    aand
    ndnd r
    rre
    eed
    dduc
    ucuci
    iib
    bbi
    iil
    lli
    iity
    tyty
    Circuit satisfiability
    ... NP-complete .......,....
    .. reducibility............ NP-
    Thus,
    complete....
    we now focus on demonstrating the
    existence of an NP-complete problem: the
    circuit-satisfiability problem.
    A boolean combinational element is any
    circuit element that has a constant number
    of boolean inputs and outputs and that
    performs a well-defined function.
    ....... 0.
    1, 0..
    FALSE. 1..
    TRUE.
    34 NP-Completeness
    53
    34.3 NP-completeness and reducibility34.3 NP-completeness and
    reducibility
    A boolean combinational circuit consists
    of one or more boolean combinational
    elements interconnected by wires.
    not and or
    34 NP-Completeness
    54
    34.3 NP-completeness and reducibility34.3 NP-completeness and
    reducibility
    x1
    x2
    x3
    34 NP-Completeness
    3
    334.3 N
    4.3 N4.3 NP-
    P-P-c
    cco
    oom
    mmp
    ppl
    lle
    eet
    tte
    eene
    nenes
    sss
    ss a
    aand
    ndndre
    rered
    dduc
    ucuci
    iib
    bbi
    iil
    lli
    iity
    tyty

    A truth assignment for a boolean
    combinational circuit is a set of boolean input
    values. We say that a one-output boolean
    combinational circuit is satisfiable if it has a
    satisfying assignment: a truth assignment
    that causes the output of the circuit to be 1.
    34 NP-Completeness
    3
    334.3 N
    4.3 N4.3 NP-
    P-P-c
    cco
    oom
    mmp
    ppl
    lle
    eet
    tte
    eene
    nenes
    sss
    ss a
    aand
    ndndre
    rered
    dduc
    ucuci
    iib
    bbi
    iil
    lli
    iity
    tyty
    The circuit-satisfiability problem is, "Given a
    boolean combinational circuit composed of
    AND, OR, and NOT gates, is it satisfiable?"
    ...... size. circuit. combinational
    element......
    CIRCUIT-SAT = {<C : C is a satisfiable
    boolean combinational circuit}.
    ................ true. false
    ..,.....,.............
    . .(2n),...... n...
    34 NP-Completeness
    3
    334.3 N
    4.3 N4.3 NP-
    P-P-c
    cco
    oom
    mmp
    ppl
    lle
    eet
    tte
    eene
    nenes
    sss
    ss a
    aand
    ndndre
    rered
    dduc
    ucuci
    iib
    bbi
    iil
    lli
    iity
    tyty
    .... CIRCUIT-SAT. NP-Complete... .
    Lemma 34.5 The circuit-satisfiability problem
    ..
    belongs to the class NP.
    lemma............
    circuit,..... truth assignment,...
    . linear time.......
    assignment.
    .... truth assignment... circuitsatisfiability
    . NP....
    34 NP-Completeness
    Circuit-satisfiability
    problem is NP-complete
    (cont.)
    • Lemma 34.6: (page 991)
    – CIRCUIT-SAT is NP-hard.
    • Proof: Suppose X is any problem in NP
    – construct a poly-time algorithm F maps
    every problem instance x in X to a circuit
    C=f(x) such that the answer to x is YES if
    and only if CÎCIRCUIT-SAT (is satisfiable).
    Circuit-satisfiability problem is NP-hard
    (cont.)

    F runs in poly time.

    Poly space:

    Size of x is n.

    Size of A is constant, independent of x.

    Size of y is O(nk).

    Amount of working storage is poly in n since A runs at
    most O(nk).

    M has size poly in length of configuration, which is poly
    in O(nk), and hence is poly in n.

    C consists of at most O(nk) copies of M, and hence is poly
    in n.

    Thus, the C has poly space.

    The construction of C takes at most O(nk) steps and
    each step takes poly time, so F takes poly time to
    construct C from x.
    Circuit-satisfiability problem is NP-hard
    (cont.)

    Since XÎNP, there is a poly-time
    algorithm A which verifies X.

    Suppose the input length is n and let T(n)
    denote the worst-case running time. Let k
    be the constant such that T(n)=O(nk) and
    the length of the certificate is O(nk).
    Circuit-satisfiability problem is NP-hard
    (cont.)

    Idea is to represent the computation of A
    as a sequence of configurations, c0, c1,
    …,ci,ci+1,…,cT(n), each ci can be broken into

    (program for A, program counter PC, auxiliary machine
    state, input x, certificate y, working storage) and

    ci is mapped to ci+1 by the combinational circuit
    M implementing the computer hardware.

    The output of A: 0 or 1– is written to some
    designated location in working storage. If the
    algorithm runs for at most T(n) steps, the
    output appears as one bit in cT(n).

    Note: A(x,y)=1 or 0.
    62
    Circuit-satisfiability problem is NP-hard (cont.)

    The reduction algorithm F constructs a
    single combinational circuit C as follows:
    – Paste together all T(n) copies of the circuit
    M.

    The output of the ith circuit, which produces
    ci, is directly fed into the input of the (i+1)st
    circuit.

    All items in the initial configuration, except
    the bits corresponding to certificate y, are
    wired directly to their known values.

    The bits corresponding to y are the inputs to
    C.
    – All the outputs to the circuit are ignored,
    except the one bit of cT(n) corresponding to
    the output of A.
    Circuit-satisfiability problem is NP-hard (cont.)
    • Two properties remain to be proven:
    – F correctly constructs the reduction, i.e., C
    is satisfiable if and only if there exists a
    certificate y, such that A(x,y)=1.
    ÜSuppose there is a certificate y, such
    that A(x,y)=1. Then if we apply the bits
    of y to the inputs of C, the output of C is
    the bit of A(x,y), that is C(y)= A(x,y) =1,
    so C is satisfiable.
    Þ
    Suppose C is satisfiable, then there is a
    y such that C(y)=1. So, A(x,y)=1.
    – F runs in poly time.
    34.3 NP-completeness and
    reducibility
    Theorem 34.7 The circuit-satisfiability
    problem is NP-complete.
    Exercises 34.3
    34.3-2 Show that the =P relation is a
    transitive relation on languages. That is,
    showthatifL=LandL=L,thenL=
    1P2 2P31P
    L3.
    34.4 NP-completeness proofs
    ....... NP-complete.......
    circuit-satisfiability problem.......
    NP.... reduce. circuit-satisfiability
    ...,............
    Lemma 34.8 If L is a language such that L' =P
    L for some L' .
    NPC, then L is NP-hard.
    Moreover, if L .
    NP, then L .
    NPC.
    .. =P. transitive...,......
    NP... L=PL' =P L,.. L. NP-hard
    ....
    34.4 NP-completeness proofs
    .
    Lemma 34.8........... NPcomplete
    ......
    1. Prove L .
    NP.
    2. Select a know NP-complete language L'.
    3. Describe an algorithm that computes a
    function f mapping every instance x .

    [continued in next message]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)