• Keine Ergebnisse gefunden

Note that Algorithm 1 still holds ifGhas an unbounded number of exchange-able pairs but only one positive (resp. negative) literal. It follows that the en-tailment problem remains NP-complete in that case. In contrast, the technique used in this algorithm does not seem to be generalizable to k ≥ 2. Take for in-stance the case where k = 2 and try to generalize Algorithm 1, replacing the literal ∼p(u) by two literals ∼p(u) and ∼q(v). Then the recursive call with in-put H +{∼p(π(u))} would be replaced by the conjunction of three recursive calls with inputsH +{∼p(π(u)),∼q(π(v))}, H +{∼p(π(u)),∼q(π(v))} and H+{∼p(π(u)),∼q(π(v))}respectively, each of these recursive calls potentially generating three new recursive calls etc, so that generalized Prop. 11 would contain an exponential number of PGsHiand homomorphismsπi.

4.3 ENTAILMENTk

We now show that, for any value of parameterk, ENTAILMENTkfalls into the class PN P, and evenP||N P, i.e., the class of decision problems solvable in polynomial time with one round of parallel queries to an NP oracle. Note that the condition on parallel queries can be relaxed by considering a constant number of rounds of parallel queries instead of a single round [BH91].

For that, we rely on Th. 2. We first deduce from this theorem a necessary and sufficient entailment condition (Prop. 12), which will be used in subsequent complexity proofs, and is also interesting for itself. Let us provide an idea of this condition on examples of Figures 2 and 5. For the graphs in Figure 2, ifp(b) is known to be true (i.e., if literal+p(b)is added toH) thenGis entailed (i.e.,Gcan be mapped toH+{+p(b)}), and if p(b) is known to be false thenGis entailed too (i.e.,Gcan also be mapped toH+{−p(b)}). Thus there are two extensible homomorphisms fromGs toH, which can be extended to homomorphisms from GtoH+{+p(b)}andH+{−p(b)}respectively, with the formulap(b)∨ ¬p(b) being a tautology. We seep(b)∨ ¬p(b)as a propositional formula on a proposi-tional language containing the atomp(b); ifbwas a variable node associated with variablez, the propositional language would contain the atomp(z)and the propo-sitional tautology would be p(z)∨ ¬p(z). Similarly, for the graphs in Figure 5, there are three extensible homomorphismsπ1, π2 and π3 from Gs toH, which mapGs to+r(a, b), +r(b, c)and +r(c, d)respectively, and can be extended to homomorphisms fromGtoH+{−p(b)},H+{+p(b),−p(c)}andH+{+p(c)}

respectively, with the proposition¬p(b)∨(p(b)∧ ¬p(c))∨p(c)being a tautology.

We will build from the set of extensible homomorphisms from any completion sub-graphG0 ofGcontained inGs toHa propositional formula that is a tautology if and only ifGis entailed byH.

We define for each completion subgraphG0 ofGand each extensible homo-morphismπ fromG0 toH the setL(π)of literals that are “missing” inH for π to be extendable to a homomorphism fromGtoH. Therefore, the literals from L(π)have to be in any completionHcofH such thatπ can be extended to a ho-momorphism fromGtoHc. FromL(π), we define propositional formulasC(π) andDG0(G, H)on a propositional language denotedPH.

Notations 1 LetGandH be two PGs, withH being consistent, and letG0 be a completion subgraph ofG.

PH denotes the set of atoms occurring inΦ(Hc\H), where Hcis an arbitrary completion ofH.

For any extensible homomorphismπfromG0toH,L(π)denotes the set of literals lsuch thatl =∼p(π(u))for some literal∼p(u)inGandlis not inH, andC(π) denotes the conjunction of the literals inL(π)which is a proposition onPH. DG0(G, H)denotes the disjunction of the propositionsC(π)for all extensible ho-momorphismsπfromG0toH.

Omission of subscriptG0 means thatG0is equal toGs.

For instance, in the previous example of Figure 5, with PH = {p(b), p(c)}

andG0 =Gs: letπ12andπ3be the extensible homomorphisms fromGstoH;

L(π1) ={−p(b)},L(π2) ={+p(b),−p(c)},L(π3) ={+p(c)},C(π1) =¬p(b), C(π2) = p(b)∧ ¬p(c)andC(π3) = p(c); finally, D(G, H) = ¬p(b)∨(p(b)∧

¬p(c))∨p(c).

Next Lemma 1 follows immediately from the definition ofL(π).

Lemma 1 LetG andH be two PGs, letHc be a completion of H, let G0 be a completion subgraph ofG, and letπ be an extensible homomorphism fromG0 to H. Thenπcan be extended to a homomorphism fromGtoHcif and only ifL(π) is a set of literals inHc.

Lemma 2 expresses the straightforward correspondence between the comple-tions ofHand the truth assignments onPH.

Lemma 2 There is a bijectionf from the set of completions of H to the set of truth assignments onPH such that for any completion Hc ofH, any completion subgraphG0 ofGand any extensible homomorphism π fromG0 toH, L(π)is a set of literals inHcif and only iff(Hc)satisfiesC(π).

Proof: Letf be the mapping from the set of completions ofH to the set of truth assignments onPH defined as follows: for every completion Hc of H, f(Hc) assigns the value true to an atomp(u)inPH if+p(u)is a literal inHc, and false otherwise (i.e., if−p(u)is a literal inHc).fclearly satisfies the desired conditions.

Proposition 12 LetGandH be two PGs, withHbeing consistent, and letG0be any completion subgraph ofGcontained in Gs. ThenGis entailed by H if and only ifDG0(G, H)is a tautology.

Proof:By Th. 2 (sinceG0is contained inGs) and Prop. 5 (sinceG0is a completion subgraph ofG),Gis entailed byH iff for each completionHcofH, there is an extensible homomorphism fromG0toHthat can be extended to a homomorphism from G to Hc. Let us show that the latter proposition holds iff DG0(G, H) is a tautology, using the bijection f of Lemma 2. ⇒: We suppose that for each completionHc of H, there is an extensible homomorphism from G0 to H that can be extended to a homomorphism fromGtoHc. Let us show thatDG0(G, H) is a tautology. Let v be a truth assignment on PH, let us show that v satisfies DG0(G, H). LetHc=f−1(v), and letπbe an extensible homomorphism fromG0 toHthat can be extended to a homomorphism fromGtoHc. By Lemma 1,L(π)is a set of literals inHc, so by Lemma 2,vsatisfiesC(π), and thereforeDG0(G, H).

⇐: We suppose thatDG0(G, H)is a tautology. LetHcbe a completion ofH, let us show that there is an extensible homomorphism fromG0toHthat can be extended to a homomorphism fromGtoHc. Letv=f(Hc). AsDG0(G, H)is a tautology, there is an extensible homomorphismπ fromG0 toH such thatvsatisfiesC(π).

By Lemmas 1 and 2,πcan be extended to a homomorphism fromGtoHc. In order to prove that ENTAILMENTk is inPN P, we show how to compute D(G, H) without explicitly computing all extensible homomorphisms from Gs toH, whose number may be exponential in the size of G. LetE be the set of exchangeable literals, andTE be the set of term nodes occurring in E. The main idea is that, for any extensible homomorphism fromGs toH, the setL(π), and therefore propositionC(π), only depend on the restriction ofπtoTE. Thus, we can defineL(ϕ)andC(ϕ)for any mappingϕfromTEto the setTHof term nodes inH, andD(G, H)is the disjunction of the propositionsC(ϕ)for every mappingϕfrom TEtoTH that can be extended to an extensible homomorphism fromGstoH. Note that a mappingϕfromTEtoTH can be extended to an extensible homomorphism fromGstoH iff it satisfies both following independent conditions: 1)ϕcan be extended to a homomorphismπfromGs toHand 2)ϕsatisfies conditions 1 and 2 of extensibility, which only depend on the restriction ofπtoTE, i.e., onϕitself.

According to Prop. 12, Algorithm 2 computesD(G, H)to determine whetherGis entailed byH.

Algorithm 2:ENTAILMENT(G, H)

Data:GandHtwo PGs, such thatHis consistent Result: true ifGis entailed byH, false otherwise begin

LetEbe the set of exchangeable literals w.r.t. (G, H) LetTE be the set of term nodes occurring inE LetGs=G\ E

Φ←f alse

forevery mappingϕfromTE to the set of term nodes inHdo

ifϕcan be extended to an extensible homomorphism fromGstoH then

Φ←Φ∨C(ϕ) returnTautology(Φ)

If the number of exchangeable pairs is bounded by a constantk, then the num-ber of mappings fromTEto the set of term nodes inHbecomes polynomial, which makes ENTAILMENTkfall intoPN P.

Theorem 5 For any integer k ≥ 0, the decision problem ENTAILMENTk is in P||N P.

Proof:It is sufficient to give an algorithm that can be executed in polynomial time with a fixed number of rounds of parallel calls to an NP-oracle. We first check with a single round whether the input is a correct instance of ENTAILMENTk, which can be done by checking each pair of literals inG. If the input is correct, we call Algorithm 2. This algorithm performs three rounds of parallel calls:

- to computeE, it is sufficient to determine for each pair ofp-opposite literals inG (whose number is polynomial) if it is exchangeable, which is in NP (first round), - |TE| ≤ 2kw, where w is the maximal arity of a relation name, so the number of mappings fromTE to the set of term nodes inH is bounded by(nH)2kw, and therefore is polynomial,

- determining if such a mappingϕcan be extended to an extensible homomorphism fromGstoHis in NP, since an extension provides a polynomial certificate (second round),

- determining if a proposition is not a tautology is in NP (third round).

It follows from Algorithm 2 that in any case where it can be decided in poly-nomial time whether the formulaΦcomputed by this algorithm is a tautology, the entailment problem is in NP. A polynomial certificate is given by a set of extensi-ble homomorphismsπfromGtoHextending the mappingsϕconsidered in this

algorithm (one for each extendable mappingϕ, so that the number of homomor-phisms π is polynomial), since computing the disjunction of the formulas C(π) and checking that it is a tautology can be done in polynomial time (we do not need to compute the setE of exchangeable literals norGs nor the mappingsϕ them-selves). In particular, it can be decided in polynomial time whether a disjunction of conjunctions of literals in which each conjunction contains at most one positive literal (or each conjunction contains at most one negative literal) is a tautology. It follows that ENTAILMENT1is in NP, which provides a new proof of Th. 4 and of the fact that the entailment problem remains NP-complete ifGhas an unbounded number of exchangeable pairs but only one positive (resp. negative) literal.