LibraryReExportIsNPComplete
From APIDesign
This page describes a way to convert any wikipedia::3SAT problem to a solution of finding the right configuration from conflicting libraries in a system that can re-export APIs. Thus proving that the later problem is wikipedia::NP-complete.
wikipedia::3SAT
The problem of satisfying a logic formula remains NP-complete even if all expressions are written in wikipedia::conjunctive normal form with 3 variables per clause (3-CNF), yielding the 3SAT problem. This means the expression has the form:
- Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/81d8cdab081df3e64bbf678339d30a6e.png , , /var/www/apidesign/httpdocs): (x_{11} \vee x_{12} \vee x_{13}) \wedge
- Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/2e23ceb8accd16e3c18865d4e0d84f10.png , , /var/www/apidesign/httpdocs): (x_{21} \vee x_{22} \vee x_{23}) \wedge
- Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/89fbd257723d67be4ba31003204134ae.png , , /var/www/apidesign/httpdocs): (x_{31} \vee x_{32} \vee x_{33}) \wedge
- Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/2f43b42fd833d1e77420a8dae7419000.png , , /var/www/apidesign/httpdocs): ...
- Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/433a35756674d660b22866bd34527e1e.png , , /var/www/apidesign/httpdocs): (x_{n1} \vee x_{n2} \vee x_{n3})
where each Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/f7c29f8af650931b6a58668170124ac3.png , , /var/www/apidesign/httpdocs): x_{ab}
is a variable Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/1df181eaa1bb40a0067c06ead197170d.png , , /var/www/apidesign/httpdocs): v_i or a negation of a variable Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/59f40fb0dfe22965c7f08c66ddfca2bc.png , , /var/www/apidesign/httpdocs): \neg v_i
. Each variable Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/1df181eaa1bb40a0067c06ead197170d.png , , /var/www/apidesign/httpdocs): v_i
can appear multiple times in the expression.
Module Dependencies Problem
Let Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/603461a02a54d311299bbe0f2ee2fd57.png , , /var/www/apidesign/httpdocs): A, B, C, ...
denote an API.
Let Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/23539be001ebf31cc0b1204218c778eb.png , , /var/www/apidesign/httpdocs): A_1, A_{1.1}, A_{1.7}, A_{1.11}
denote compatible versions of API Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/7fc56270e7a70fa81a5935b72eacbe29.png , , /var/www/apidesign/httpdocs): A
.
Let Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/3af6e7b3a4a6412d2fd9a134660bf029.png , , /var/www/apidesign/httpdocs): A_1, A_{2.0}, A_{3.1}
denote incompatible versions of API Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/7fc56270e7a70fa81a5935b72eacbe29.png , , /var/www/apidesign/httpdocs): A
.
Let Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/d3747fe17dea5426abe438fc8a47a064.png , , /var/www/apidesign/httpdocs): A_{x.y} > B_{u.v}
denote the fact that version x.y of API A depends on version u.v of API B.
Let Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/0cef438625ca45280c922aaf3d8d7bd9.png , , /var/www/apidesign/httpdocs): A_{x.y} \gg B_{u.v}
denote the fact that version x.y of API A depends on version u.v of API B and that B re-exports its elements.
Let Repository Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/5f0c2abe81264bb793e9c277e5d23a42.png , , /var/www/apidesign/httpdocs): R=(M,D)
be any set of modules with their various versions and their dependencies on other modules with or without re-export.
Let C be a Configuration in a repository Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/5f0c2abe81264bb793e9c277e5d23a42.png , , /var/www/apidesign/httpdocs): R=(M,D) , if Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/ccb62089b190b0fbd045249cbcd47fc9.png , , /var/www/apidesign/httpdocs): C \subseteq M , where following is satisfied:
- Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/933575179f38635778eb726243afda3f.png , , /var/www/apidesign/httpdocs): \forall A_{x.y} \in C, \forall A_{x.y} \gg B_{u.v} \in D \Rightarrow \exists w >= v \wedge B_{u.w} \in C
- each re-exported dependency is satisfied with some compatible version
- Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/8a64fff2b98c6fd70e01eecf6caa1d03.png , , /var/www/apidesign/httpdocs): \forall A_{x.y} \in C, \forall A_{x.y} > B_{u.v} \in D \Rightarrow \exists w >= v B_{u.w} \in C
- each dependency is satisfied with some compatible version
- Let there be two chains of re-exported dependencies Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/ea05cb7649741b2628bf63ab9aa0ecbd.png , , /var/www/apidesign/httpdocs): A_{p.q} \gg ... \gg B_{x.y}
and Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/3355e82c29534cf56c7a4436ec086a94.png , , /var/www/apidesign/httpdocs): A_{p.q} \gg ... \gg B_{u.v}
then Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/37ba8d851c836f6ca0158c0be1489f40.png , , /var/www/apidesign/httpdocs): x = u \wedge y = v
- this guarantees that each class has just one, exact meaning for each importer
Module Dependency Problem: Let there be a repository Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/5f0c2abe81264bb793e9c277e5d23a42.png , , /var/www/apidesign/httpdocs): R=(M,D)
and a module Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/4cfccc68f6f2a85824f1e2aa908a72a2.png , , /var/www/apidesign/httpdocs): A \in M
. Does there exist a configuration Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/0d61f8370cad1d412f80b84d143e1257.png , , /var/www/apidesign/httpdocs): C
in the repository Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/e1e1d3d40573127e9ee0480caf1283d6.png , , /var/www/apidesign/httpdocs): R
, such that the module Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/21b399ddb43f8c61fbea617b595cba1b.png , , /var/www/apidesign/httpdocs): A \in C , e.g. the module can be enabled?
Converstion of wikipedia::3SAT to Module Dependencies Problem
Let there be wikipedia::3SAT formula with with variables Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/8d70b5d26b99f566646b0538598fa174.png , , /var/www/apidesign/httpdocs): v_1, ..., v_m
as defined above.
Let's create a repository of modules Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/e1e1d3d40573127e9ee0480caf1283d6.png , , /var/www/apidesign/httpdocs): R . For each variable Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/1df181eaa1bb40a0067c06ead197170d.png , , /var/www/apidesign/httpdocs): v_i
let's create two modules Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/7f452842ac00f6d3f3eb60578b77bd23.png , , /var/www/apidesign/httpdocs): M^i_{1.0}
and Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/4bb26054d98decfa57f82430a4d3a170.png , , /var/www/apidesign/httpdocs): M^i_{2.0}
, which are mutually incompatible and put them into repository Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/e1e1d3d40573127e9ee0480caf1283d6.png , , /var/www/apidesign/httpdocs): R .
For each formula Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/c1498563a9f700cb96cf7611298134e5.png , , /var/www/apidesign/httpdocs): (x_{i1} \vee x_{i2} \vee x_{i3})
let's create a module Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/28b67ea410229674c5d5d4a04a33a1d2.png , , /var/www/apidesign/httpdocs): F^i
that will have three compatible versions. Each of them will depend on one variable's module. In case the variable is used with negation, it will depend on version 2.0, otherwise on version 1.0. So for the formula
- Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/803d7b7edeb63d092ecc88e132a263a2.png , , /var/www/apidesign/httpdocs): v_a \vee \neg v_b \vee \neg v_c
we will get:
- Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/6bb47c22363dc2ffd51dda3e86a7e274.png , , /var/www/apidesign/httpdocs): F^i_{1.1} \gg M^a_{1.0}
- Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/615a1413dab927c3099aca1507f14e82.png , , /var/www/apidesign/httpdocs): F^i_{1.2} \gg M^b_{2.0}
- Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/2604ee0bea1fd5f7a1c5bfda52962e94.png , , /var/www/apidesign/httpdocs): F^i_{1.3} \gg M^c_{2.0}
All these modules and dependencies add into repository Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/e1e1d3d40573127e9ee0480caf1283d6.png , , /var/www/apidesign/httpdocs): R
Now we will create a module Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/7eb58621dac37118dbc66c2dd1d086ed.png , , /var/www/apidesign/httpdocs): T_{1.0}
that depends all formulas:
- Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/2207938d277d27bbd59de0d094cabc58.png , , /var/www/apidesign/httpdocs): T_{1.0} \gg F^1_{1.0}
- Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/c6f5220383f4be5f134419879ab108ca.png , , /var/www/apidesign/httpdocs): T_{1.0} \gg F^2_{1.0}
- ...
- Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/5d5722baf8addb9b66910982f3b879d8.png , , /var/www/apidesign/httpdocs): T_{1.0} \gg F^n_{1.0}
and add this module as well as its dependencies into repository Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/e1e1d3d40573127e9ee0480caf1283d6.png , , /var/www/apidesign/httpdocs): R .
Claim: There Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/32ff223f4b9214ce44a3f7cac5abe8bf.png , , /var/www/apidesign/httpdocs): \exists
a configuration Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/0d61f8370cad1d412f80b84d143e1257.png , , /var/www/apidesign/httpdocs): C
of repository Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/e1e1d3d40573127e9ee0480caf1283d6.png , , /var/www/apidesign/httpdocs): R
and Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/89890f62c55c51677985649163abb4e4.png , , /var/www/apidesign/httpdocs): T_{1.0} \in C
Failed to parse (math_image_error /var/www/apidesign/httpdocs/images/tmp/755eceba2d1c23fb97b1d4eb3a880058.png , , /var/www/apidesign/httpdocs): \Longleftrightarrow
there is a solution to the wikipedia::3SAT formula.