Download presentation

Presentation is loading. Please wait.

Published byAditya Gascoigne Modified over 3 years ago

1
CSci 4011 INHERENT LIMITATIONS OF COMPUTER PROGRAMS

2
**HARDEST PROBLEMS IN NP Definition: A language B is NP-complete if:**

Theorem: A language B is NP-complete if: 1. B NP 2. A is NP-complete and A ≤P B 2. Every A in NP is poly-time reducible to B (i.e. B is NP-hard) If B is NP-Complete and P NP, then There is no fast algorithm for B.

3
**REDUCTION STRATEGIES A reduction by restriction shows that the source**

problem is a special case of the target problem. For example, 3SAT ≤P CNF-SAT because every satisfiable 3CNF is also a satisfiable CNF. Example. Prove 3SAT ≤P 4SAT by restriction. A 3CNF can be converted to an equivalent 4CNF by repeating one literal in each clause.

4
**REDUCTION STRATEGIES A reduction from A to B by local replacement**

shows how to “translate” between “units” of A and “units” of B. Example. vertex cover “units” are vertices and edges; set cover “units” are elements and sets. Example. CIRCUIT-SAT units are gates, CNFSAT units are clauses, 3SAT units are 3-literal clauses.

5
**GRADUATION A transcript is a set of course numbers a student has taken**

A major consists of: Pairs: exactly one of which must be taken Lists: at least one course of which must be taken GRADUATION = {〈T,M〉 | a subset of T satisfies M} For example: T = {1901A, 1902B, 1902A, 2011, 4041A, 4061, 4211} M = [1901A,1901B], [1902A,1902B] (4011,4041A,4041B), (4211,4707), (4061)

6
GRADUATION ∈ NP: The subset is a proof that (T,M) ∈ GRADUATION. 3SAT ≤P GRADUATION: T = {101, 102, 201, 202, 301, 302} (x1 ⋁ x2 ⋁ ¬x3) ∧ (¬x1 ⋁ x2 ⋁ x2) ∧ (¬x2 ⋁ x3 ⋁ x1) M = [101, 102], [201, 202], [301, 302] (101,201,302), (101,201,201), (101,202,301)

7
GRADUATION ∈ NP: The subset is a proof that (T,M) ∈ GRADUATION. 3SAT ≤P GRADUATION: Let = C1 ∧ C2∧ … ∧Cm have variables x1…xk For each xi: add classes i01 and i02 to T. add pair (i01,i02) to M. For each Cj, we add a triple to M: if xi is a literal in Cj, the triple includes i01. if ¬xi is a literal in Cj, the triple includes i02.

8
**UHAMPATH No HAM PATH Undirected HAM PATH A B A B C D C D E F E F**

UHAMPATH = {〈G,s,t〉 | G is an undirected graph with a Hamiltonian path from s to t}

9
HAMPATH ≤P UHAMPATH Amid A B Aout Ain C D E F

10
HAMPATH ≤P UHAMPATH A B C D E F

11
**HAMPATH ·P UHAMPATH f(G,s,t) = (G’,s’,t’) where: For each node u G:**

add nodes uin, uout, umid to G’. add edges {uin,umid} and {umid,uout} to G’ For each edge (u,v)G, add {uout,vin} to G’ s’ = sin, t’ = tout. If 〈G,s,t〉 HAMPATH, then 〈G’,s’,t’〉UHAMPATH: (s,u,v,..,t) ! (sin,smid,sout,uin,umid,uout,vin,vmid,vout,…tout)

12
**If v2 smid, then no vi=smid. So v2=smid, v3=sout**

HAMPATH ·P UHAMPATH If 〈G’,s’,t‘〉 2 UHAMPATH, then 〈G,s,t〉2 HAMPATH: Let (sin=v1,v2,…,v3n=tout) be the undirected path. Claim: for all i≥0, there exists u G so that: v3i+1=uin, v3i+2=umid, v3i+3=uout. i=0: If v2 smid, then no vi=smid. So v2=smid, v3=sout Induction: if v3i = u’out, then v3i+1=uin, so v3i+2=umid. The directed Hamiltonian path is (u1, u2, …, un)

13
**3SAT P SUBSET-SUM We transform a 3-cnf formula into 〈y1…yn, t〉:**

3SAT 〈y1…yn,t〉 SUBSET-SUM The transformation can be done in time polynomial in the length of

14
**x2 x1 x1 (x1 ⋁ x2 ⋁ x2) ∧ (¬x1⋁ x2 ⋁ x2) ∧ (x1 ⋁ ¬x2 ⋁ x2) x2**

Each variable and each clause result in two yi’s. Each yi will have a digit for each clause and variable. x2 x1 C3 C2 C1 y1 1 y2 y3 y4 y5 y6 y7 y8 y9 y10 t 3 x1 (x1 ⋁ x2 ⋁ x2) ∧ (¬x1⋁ x2 ⋁ x2) ∧ (x1 ⋁ ¬x2 ⋁ x2) x2 C3 C2 C1

15
**REDUCTION STRATEGIES A reduction by component design constructs**

gadgets that simulate variables and clauses. In particular a reduction must provide: a gadget to force the solution to the target instance to choose either x or ¬x a gadget to force the solution to the target instance to choose one literal from each clause a gadget to force the solution to the target instance to satisfy every clause

16
K-CLIQUES b a e c d f g

17
**3SAT P CLIQUE We transform a 3-cnf formula into 〈G,k〉 such that**

3SAT 〈G,k〉 CLIQUE The transformation can be done in time polynomial in the length of

18
**(x1 x1 x2) (x1 x2 x2) (x1 x2 x2)**

k = #clauses

19
**(x1 x1 x1) (x1 x1 x2) (x2 x2 x2) (x2 x2 x1)**

20
**3SAT P CLIQUE We transform a 3-cnf formula into 〈G,k〉 such that**

3SAT 〈G,k〉 CLIQUE If has k clauses, we create a graph with k clusters of 3 nodes each. Each cluster corresponds to a clause. Each node in a cluster is labeled with a literal from the clause. We do not connect any nodes in the same cluster We connect nodes in different clusters whenever they are not contradictory

21
**3SAT P CLIQUE We transform a 3-cnf formula into 〈G,k〉 such that**

3SAT 〈G,k〉 CLIQUE is satisfiable iff there is an assignment that makes at least one literal true in each clause. The nodes corresponding to these k true literals do not contradict each other, so they form a k- clique in G. A k-clique in G must have one node from each cluster. Setting the corresponding literals to true will satisfy

22
**VERTEX COVER Theorem: VERTEX-COVER is NP-Complete**

b a e c d b a e c d Theorem: VERTEX-COVER is NP-Complete (1) VERTEX-COVER NP (2) CLIQUE ≤P IND-SET ≤P VERTEX-COVER

23
**VERTEX-COVER = { 〈G,k〉 | G is an undirected graph with a k-node vertex cover }**

Theorem: VERTEX-COVER is NP-Complete (1) VERTEX-COVER NP (2) 3SAT P VERTEX-COVER

24
3SAT P VERTEX-COVER We transform a 3-cnf formula into 〈G,k〉 such that 3SAT 〈G,k〉 VERTEX-COVER The transformation can be done in time polynomial in the length of

25
**(x1 x1 x2) (x1 x2 x2) (x1 x2 x2)**

k = 2(#clauses) + (#variables)

26
HAMILTONIAN PATHS b a e c d f h i g

27
**HAMPATH = { 〈G,s,t〉 | G is a graph with a Hamiltonian path from s to t }**

Theorem: HAMPATH is NP-Complete (1) HAMPATH NP (2) 3SAT P HAMPATH

28
**3SAT P HAMPATH We transform a 3-cnf formula into 〈G,s,t〉 so that**

3SAT 〈G,s,t〉 HAMPATH The transformation can be done in time polynomial in the length of

29
(x1 Ç x2 Ç x2) Æ (:x1 Ç x2 Ç x2) s x1 x1 x2 x2 t

30
(x1 Ç x2 Ç x2) Æ (:x1 Ç x2 Ç x2) s x1 c1 x11 x12 x21 x22 x1 x2 x2 t

31
**(x1 Ç x2 Ç x2) Æ (:x1 Ç x2 Ç x2) s x1 x11 x12 x14 x15 x1 c1 c2 x2 x21**

t

32
3-COLORING b a e c d b a e c d a a d d b b c

33
**3SAT P 3COLOR We transform a 3-cnf formula into a graph G so**

3SAT G 3COLOR The transformation can be done in time polynomial in the length of

34
(x1 Ç x2 Ç x2) ? x1 x2 F T

35
(x1 Ç x2 Ç x2) ? x1 x1 F T x2 x2 c11 c12 c13 c14 c15 c16

36
**(x1 Ç x2 Ç x2) Æ (x2 Ç :x1 Ç :x1) ? x1 x1 F T x2 x2 c11 c12 c13 c11**

37
**(x1 Ç x2 Ç x2) Æ (x2 Ç :x1 Ç :x1) ? x1 x1 F T x2 x2 c11 c12 c13 c11**

38
MORE GADGETS

39
MORE GADGETS

Similar presentations

Presentation is loading. Please wait....

OK

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.

INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on charge coupled device Download ppt on nutrition in human beings Ppt on inhabiting other planets in other galaxies Ppt on paintings and photographs related to colonial period homes Download ppt on asexual reproduction in plants Ppt on two stroke petrol engine Cloud computing microsoft ppt online Ppt on cellular technologies and security Ppt on holographic technology Ppt on needle stick injury treatment