SciELO - Scientific Electronic Library Online

 
vol.26 número1Emotion-Aware Explainable Artificial Intelligence for Personality, Emotion, and Mood SimulationPermutation Based Algorithm Improved by Classes for Similarity Searching índice de autoresíndice de materiabúsqueda de artículos
Home Pagelista alfabética de revistas  

Servicios Personalizados

Revista

Articulo

Indicadores

Links relacionados

  • No hay artículos similaresSimilares en SciELO

Compartir


Computación y Sistemas

versión On-line ISSN 2007-9737versión impresa ISSN 1405-5546

Comp. y Sist. vol.26 no.1 Ciudad de México ene./mar. 2022  Epub 08-Ago-2022

https://doi.org/10.13053/cys-26-1-4152 

Articles of the Thematic Issue

Model Checking Algorithm for Repairing Inference between Conjunctive Forms

Guillermo De  Ita1  * 

Pedro Bello1 

1 Benemérita Universidad Autónoma de Puebla, Facultad de Ciencias de la Computación, Mexico. pb5pbello@gmail.com.


Abstract:

Let K be a propositional formula and let ϕ be a query, the propositional inference problem Kϕ is a Co-NP-complete problem for propositional formulas without restrictions. We show the existence of polynomial-time cases for some fragments of propositional formulas K and ϕ that are different from the already known case of Horn formulas. For example, in the case that K is a formula in the fragment Krom or Horn or Monotone, then Kϕ can be decided in polynomial-time for any CNF ϕ.

Given two conjunctive normal forms (CNF’s) K and ϕ, when Kϕ, our proposal builds a minimal set of independent clauses S. The falsifying assignments of S are exactly the subset of models of K, which are not models for ϕ. In this way, the CNF S could extend the initial formula K in such a way that repair the inference, it is (SK)ϕ is held.

Keywords: Propositional inference; repairing inference; reasoning s; NP-complete; Co-NP-complete

1 Introduction

The primary goal of complexity theory is to classify computational problems according to their inherent computational complexity. A central issue in determining these frontiers has been the satisfiability problem (SAT) in propositional calculus.

The case 2-SAT, which consists in determining the satisfiability of propositions in two Conjunctive Normal Forms (2-CNF), is an important tractable case of SAT (see e.g. [2, 5, 12] for polynomial-time algorithms for 2-SAT). Meanwhile, if F is a 3-CNF formula, then the determination of the satisfiability of F is a classical NP-complete problem.

The analysis on the algorithms solving SAT problems has been helpful for delimiting frontiers between tractable and non-tractable problems.

In fact, the 2-CNF (Krom formulas) is a fragment of propositional formulas that has been very useful to clarify the computational time-complexity for different types of problems. Variations of the 2-SAT problem (i.e. in the optimization and counting area) have been key for establishing frontiers between tractable and intractable problems. Some problems related to 2-SAT remain intractable such as: Max-2SAT (finding an assignment that maximizes the number of satisfying clauses of F), Min-2SAT (finding a model of F with a minimum number of true variables) [12], and #2SAT (counting the number of models of F) [1, 6].

SAT problem has many applications and it has been shown to be fundamental for solving deductive reasoning problems [15, 17]. The automation of deductive reasoning is a basic and challenging logic problem [18]. Deductive propositional reasoning is usually abstracted as follows: Given a propositional formula K (capturing the knowledge about a domain), and a propositional formula ϕ (a query capturing the situation at hand), then the goal of reasoning is to determine whether K implies ϕ, which is presented as Kϕ. This is known as the propositional inference problem (or the entailment problem).

We analyze here the computational complexity of the propositional inference problem Kϕ, considering K and ϕ as conjunctive normal formulas (CNF).

We want to determine the characteristics on the formula K such that Kϕ is performed efficiently and determine the frontier when this inference problem changes to be intractable.

Since automatic reasoning is one of the purer forms of human intellectual thought, the automation of such reasoning by means of computers is a basic and challenging scientific problem [18]. Thus, one of the fundamental problems in automatic reasoning is the propositional inference problem. This last problem is a relevant task in many other issues such as: estimating the degree of belief, belief revision, abductive explanation, logical diagnosis, and many other procedures in Artificial Intelligence (AI) applications.

Inference operations are present not only in logic but in many areas of mathematics. The concept of logical inference has proven to be more fruitful for the development of a general logic theory than the concept of theorem and of logical validity. Abstract inference operations are known as closure operators in universal algebra and lattice theory [13]. In this research, we consider the inference problem Kϕ from an algorithmic point of view, instead of the algebraic perspective that Beyersdorff [3] used.

The current techniques that are most used to automatically check Kϕ, when K and ϕ are CNF’s, are the resolution method [4] and the systems type Gentzen [11]. However, these processes have not only an inherent exponential complexity, but also they lack of a recovery proposal when Kϕ. On the contrary, our proposal for checking Kϕ allows to build a new CNF H for repairing Kϕ by (KH)ϕ. Notice that KH continues as a CNF; therefore, our proposal is closed on conjunctive forms.

Contribution In our main results, we show that apart from the fragment of Horn formulas, there are other fragments of the propositional calculus where Kϕ is polynomial-time decidable. We also present an algorithm for Kϕ, when K and ϕ are two CNF’s without restrictions. While Kϕ is been checked, our proposal also builds a minimal set of independent clauses S such that if Kϕ, then S repairs the inference, that is, (KS)ϕ.

This is key for applications of automatic reasoning in belief revision and abductive explanation problems [7].

The remainder of this paper is organized as follows. In the following section some preliminaries are established. Section 3 introduces the main data structures to be used in this work. In this section also is analyzed the first simple cases of the propositional inference on limited fragments of conjunctive forms, and some efficient cases for the problem of inference between conjunctive forms are established. In section 4, the general problem of inference between conjunctive forms is analyzed, as well as the time-complexity analysis of our algorithmic proposal. Finally, in the last section the conclusions are presented.

2 Preliminaries

Let X={x1,,xn} be a set of n Boolean variables. A literal is either a variable xi, or a negated variable x¯i. We indistinctly denote the negation of a literal l as l¯ or ¬l. A variable xX appears in a formula F only if either x or x¯ is an element of F. The size of a CNF F, denoted as |F|, is defined as the sum of the occurrences of literals appearing in F.

A clause C is a disjunction of different and non-complementary literals. In this article, we discard the case of tautological clauses. For kN, a k-clause is a clause consisting of exactly k literals, and a (k)-clause is a clause with at most k literals. A phrase D is a conjunction of literals, while a k-phrase is a phrase with exactly k literals.

A conjunctive normal form (CNF) F is a conjunction of non-tautological clauses. We say that F is a monotone positive CNF if all of its variables appear in unnegated form. An F is monotone when each literal of F appears with just one of its signs. When a literal l of F appears with only one of its signs, then l is called a pure literal in F.

A k-CNF is a CNF containing only k-clauses. (k)-CNF denotes a CNF containing clauses with at most k literals. A 2-CNF formula F is said to be strict only if each clause of F consists exactly of two literals. In particular cases, we consider a CNF as a set of clauses.

A disjunctive normal form (DNF) is a disjunction of phrases, and a k-DNF is a DNF containing only k-phrases.

We use υ(X) to represent the variables appearing in X, where X can be a literal, a clause, a phrase, a DNF, or a CNF. For instance, for the clause c={x¯1,x2}, υ(c)={x1,x2}. In addition, we used ¬Y as the negation operator of the logical element Y (a variable, a CNF, or a formula). Lit(F) is the set of literals involved in F, even if they appear with only one of the two signs. For example, if X=υ(F), then Lit(F)=X¬X={x1,x¯1,,xn,x¯n}. We denote {1,2,,n} by n, and the cardinality of a set A by |A|.

An assignment s for a formula F is a function s:υ(F){0,1}. An assignment s can also be considered as a set of literals without a complementary pair of literals, e.g., if ls, then l¯s. In other words, s turns l true and l¯ , or vice versa. Let C be a clause and s an assignment. Considering C as a set of literals, then we have that C is satisfied by s if and only if (Cs)0. On the other hand, if for all lC, l¯s, then s falsifies C. A phrase D is satisfied by an assignment s if Ds.

A model of F is an assignment for υ(F) that satisfies F. Meanwhile, a falsifying assignment of F is an assignment for υ(F) that contradicts F. Let F be a CNF, F is satisfied by an assignment s if each clause in F is satisfied by s. F is contradicted by s if any clause in F is falsified by s. Meanwhile, a DNF F is satisfied by s if any phrase in F is satisfied by s. F is contradicted by s if all phrases in F are contradicted by s.

If n=|υ(F)|, then there are 2n possible assignments defined over υ(F). Let S(F) be the set of 2n assignments defined over υ(F). sF denotes that the assignment s is a model of F, and sF denotes that s is a falsifying assignment of F. SAT(F) is the set containing all satisfying assignment of F (models of F), where specific values are assigned to all variables of F. On the other hand, FAL(F) is the set containing all falsifying assignments of F.

Considering a CNF F as a set of clauses, and F1F as a formula consisting of some (not all) clauses from F, if υ(F1)υ(F), then an assignment over υ(F1) is a partial assignment for F. If n=|υ(F)| and n1=|υ(F1)|, then any assignment over υ(F1) has 2nn1 as assignment extensions over υ(F). If s has logical values determined for each variable in F, then s is a total assignment, or just an assignment of F.

We denote F[s] as the operation of the substitution of the literals in F by the logical values taken for those literals in the assignment s, and after, to perform any tautological operation appearing in F[s].

The notation SAT(F) is extended by considering general propositional formulas F, not only CNF’s, but also when SAT(F) is the set of assignments defined on υ(F) such that sF. The SAT problem consists on determining if F has a model, i.e., if SAT(F)0. 2-SAT denotes the SAT problem only defined on 2-CNF’s. #SAT(F) denotes the counting problem of determining the number of models of F. #2SAT denotes #SAT for 2-CNF formulas. Meanwhile, #FAL(F) counts the number of falsifying assignments of F.

Clearly, for any propositional formula F, S(F)=SAT(F)FAL(F). Then, FAL(F)=S(F)SAT(F) by complementary properties on the set of assignments. On the other hand, if n=|υ(F)| then #FAL(F)=2n- #SAT(F).

It is known that the logical inference problem is a hard challenge in automatic reasoning, and it is a Co-NP-complete problem even in the propositional case. Let L be the set of all propositional formulas. L(B) denotes the set of all propositional formula expressed in the fragment B of propositional calculus. For example, L(DNF), L(Krom), L(Horn), L(Mon) denote the set of all Disjunctive Normal forms, 2-CNF’s, Horn-formulas, and monotone formulas, respectively.

The problem to be analyzed here is the inference problem on fragments B of the propositional calculus, which is established as:

Problem IMP(B)

Instance: Let ϕ be a CNF and let K be a propositional formula expressed in the fragment B.

Question: Does Kϕ hold?

We analyze the IMP(B) problem from an algorithmic point of view more than from an algebraic perspective, as it was analyzed by Beyersdorff [3].

3 Inference on Fragments of Conjunctive Forms

Let F be a CNF and let l be a literal, the reduction of F by l, denoted by F[l], is the formula generated by removing from F the clauses containing l (subsumption), and by removing l¯ from the remaining clauses (unit resolution on F).

The reduction of a formula F by a set of literals can be inductively established as follows: let s={l1,l2,,lk} be a partial assignment of υ(F). The reduction of F by s is defined by successively applying F[li], li, i=1,,k. The reduction of F by l1 gives the formula F[l1], following a reduction of F[l1] by l2, giving as a result the formula F[l1,l2] and so on. The process continues until F[s]=F[l1,,lk] is reached. In case that s=0 then F[s]=F.

Example 1. Let F={{x1,x¯2},{x1,x2},{x1,x3},{x¯1,x3},{x¯2,x4},{x¯2,x¯4},{x2,x5},{x¯5}}. Then, F[x2]={{x1},{x1,x3},{x¯1,x3},{x4},{x¯4},{x¯5}}, and If s={x2,x¯3}, F[s]={{x1},{x1},{x¯1},{x4},{x¯4},{x¯5}}.

Let K be a CNF and let s be a partial assignment of K. If a pair of contradictory unitary clauses is obtained while K[s] is being computed, then K is falsified by the assignment s.

Furthermore, during the computation of K[s], new unitary clauses can be generated. Thus, the partial assignment s is extended by adding the unitary clauses found, that is, s=s{u} where {u} is a unitary clause. Moreover, K[s] can be reduced again using the new unitary clauses. The above iterative process is generalized, and we call Unit_Propagation(K,s) to this iterative process. For simplicity, we abbreviate Unit_Propagation(K,s)as UP(K,s).

As a result of applying UP(K,s), we obtain a new assignment s that extends to s, and a new subformula K formed by the clauses from K that are not satisfied by s. We denote as K0 = K=UP(K,s) to the formula K resulting of the application of Unit Propagation on K by the assignment s.

Notice that if s falsifies K then s could have complementary literals, and K is unsatisfiable. In addition, when s satisfies K, then K is empty.

The direct implementation of unit propagation takes time quadratic in the total size of the set to check, which is defined to be the sum of the size of all clauses, where the size of each clause is the number of literals it contains. Unit propagation can however be done in linear time by storing, for each variable, the list of clauses in which each literal is contained [19].

Let K be a CNF, K=i=1mCi, where each Ci is a clause. For each clause Ci, im, the assignment s such that Ci[s]=1, contains at least one literal of Ci, and if Ci[s]=0, then all literal lCi appears as l¯ in s. It is easy to build FAL(K) when K is a CNF, since each clause CiK determines a subset of falsifying assignments of K. Therefore, FAL(K) is the union of those falsifying assignments for each clause in K, this means that:

FAL(K)=i=1m{sS(K)|FAL(Ci)s}.

The following Lemma shows that the subsets of satisfiable formulas are also satisfiable.

Lemma 1. If K is a satisfiable CNF, then KK, K is a satisfiable CNF.

Proof. We know by the previous Lemma that FAL(K)=CiKFAL(Ci)S(K), and this last containment is strict because K is satisfiable. Clearly, if we discard some clauses from K, forming K, then FAL(K)=CiKFAL(Ci)CiKFAL(Ci)S(K). Thus, K is satisfiable.

Lemma 2. Let K be an unsatisfiable CNF, CNF K such that KK, K remains unsatisfiable.

Proof. For an unsatisfiable CNF K, it holds that FAL(K)=CiKFAL(Ci)=S(K). Therefore, if we add new clauses to K forming K, then FAL(K)=CiKFAL(Ci)CiKFAL(Ci). Since CiKFAL(Ci)=S(K), then we obtain that also CiKFAL(Ci)=S(K). Thus, K is unsatisfiable.

Let K and ϕ be two propositional formulas, we say that K implies ϕ, written as Kϕ, if ϕ is satisfied for each model of K, i.e., if SAT(K)SAT(ϕ). The last containment can be expressed via the falsifying sets of the formulas as in the following Lemma:

Lemma 3. FAL(ϕ)FAL(K) if and only if Kϕ.

Proof. This property comes from the basic properties on sets that are closed under complementation and because of S(K)=SAT(K)FAL(K). Then, (FAL(ϕ)FAL(K))(SAT(K)SAT(ϕ))Kϕ.

3.1 Building Strings to Falsify Clauses and to Satisfy Phrases

Let K and ϕ be two CNF’s, K=i=1mCi and ϕ=i=1kφi. Each set FAL(Ci) can be represented in a succinct way via a string Ai of length n=|υ(K)|. Given a clause Ci=(xi1xik), then the value at each position from i1-th to ik-th of the string Ai is fixed with the truth value that falsifies each literal of Ci. E.g., if xijCi, the ij-th element of Ai is set to 0. On the other hand, if x¯ijCi, then the ij-th element is set to 1.

The variables in υ(K) which do not appear in Ci are represented by the symbol *, meaning that they could take any logical value in the set {0,1}. In this way, the string Ai of length n=|υ(K)| represents the set of assignments falsifying the clause Ci. E.g. if K={C1,,Cm} is a 2-CNF, n=|υ(K)|, C1={x1x2} and C2={x2x¯3}, the assignments of FAL(C1) can be represented by the string 00 and the assignments of FAL(C2) are represented by the string 01.

We call falsifying string to the string Ai that represents the set of falsifying assignments of a clause Ci. We denote by Fals(Ci), the string (with n symbols), that is the falsifying string of the clause Ci. For purposes of evaluating a falsifying string s=Fals(Ci)=s1s2sk on a formula F, we would consider s as only one assignment on the set of variables X={x1,,xk} of F. The evaluation F[s] is defined in orded to iterate on each symbol si, ik of the string, this is, F[s]=F[s1,,sk], in the following way. F[si]=F, if si=. F[si]=F[xi] when si=1, and F[si]=F[x¯i] for si=0.

On the other hand, let σ=(l1lj) be a phrase defined over Lit(K). A string υσ of n symbols is associated with σ, and each one of its values υσ[i], i=1,,n is determined as:

υσ[i]={1ifxiσ,0ifxiσ,*ifneitherxiσnorx¯iσ. (1)

The string υσ is a succinct form to represent SAT(σ), because any assignment s over K is a satisfying assignment for σ, when s and υσ coincide their values (0 or 1) in the same positions,

Thus, υσ represents the set of 2n|σ| satisfying assignments for σ. Therefore, we call υσ as the satisfying string of the phrase σ.

The use of strings to represent a set of assignments has been very useful to design reasoning procedures, e.g. for computing belief revision operators, or not redundant families of subcubes [10, 16].

3.2 Basic Cases for the Inference Problem Kϕ

Let X=υ(K) and Lit(K)=XX¯ be the set of variables and the set of literals appearing in K, respectively. Let us assume K a satisfiable formula, and ϕ that consists of only one literal l. For this class of formulas, we analyze what happens to Kl.

  • — Case lLit(K): When lυ(K) then Kl, because any model m of K can be extended as m{¬l} that is a satisfying assignment for K, but falsifies l.

  • — Case lLit(K): Consider the formula K1=K[¬l]. In this case, if SAT(K1)0 then Kl, because any model m of K1 can be extended as m{¬l} that is a model for K but falsifies l. Otherwise, SAT(K1)=0 and Kl, because there are not models for K doing false to l.

Now, let us consider the case where ϕ is formed by just one clause, ϕ=(l1lk). An initial situation is given by υ(K)υ(ϕ)=0.

Theorem 1. Let K be a satisfiable CNF and let ϕ be a non-tautology clause. If (υ(K)υ(ϕ))=0, then Kϕ.

Proof. Let sFals(ϕ), s exists since ϕ is a non-tautology, and additionally, s has not assigned values for variables in K, since (υ(K)υ(φ))=0. Let uSat(K), u exists since K is satisfiable. Let v=su be an assignment for all variables in K and ϕ. v is a valid assignment because it has non contradictory literals, since (υ(K)υ(ϕ))=0. Furthermore, ϕ[v]=false and K[v]=true by construction of v, and then, Kϕ. Thus, v is a witness of the succinct disqualification of Kϕ.

On the other hand, let us assume that ϕ continues as one clause ϕ=(l1lk), and that υ(K)υ(ϕ)0. In this case, let K1=UP(K,[l1,,l¯k]). If K1 is satisfiable, then Kϕ; otherwise Kϕ. When K1 is satisfiable, then a model m for K1 exists and the assignment s=m{l¯1,,l¯k} is valid since it does not have complementary literals, and s holds K[s]=true and ϕ[s]=false. Thus, Kϕ. Notice that the computational complexity for determining Kϕ is inherently related of the computational complexity of determining Sat(K1).

Lemma 4. Let sFals(ϕ). If K=UP(K,s) is formed by clauses with at least one pure literal, then Kϕ.

Proof. Let sFals(ϕ) and let K=UP(K,s)=C1Ck. Let u1=ili, where li is a pure literal in CiK, then K[u1]=true since each clause in K has at least one pure literal. Let u=u1s be a valid assignment, since υ(K)υ(ϕ)=0, and then Kϕ, by theorem 1.

Let K=K1K2, where for each CK2 there is a literal liC that is pure in K2 and liLit(ϕ).

Lemma 5. Kϕ if and only if K1ϕ.

Proof. () If K1ϕ then FAL(ϕ)FAL(K1). Also, FAL(K1)FAL(K) since K contains a K1, and it is possible that K has more clauses than those in K1. By property of subsets FAL(ϕ)FAL(K), and then Kϕ, by Lemma 3.

() By contradiction. Assume that Kϕ and K1ϕ. If K1ϕ, then an assignment sFals(ϕ) exists, and K1[s]=true. Let u1=ili, where li is a pure literal in K2. Thus, K2[u1]=true. Let v=su1, v is a valid assignment because any li is pure in K2(liu1) and l¯is (since liLit(ϕ). Furthermore, K[v]=true and ϕ[v]=false, and then Kϕ - a contradiction. Therefore, K1ϕ.

Let us consider the problem of propositional inference: Kϕ, where K and ϕ are two general CNF’s. The decision problem Kϕ is a Co-NP-complete problem for CNF’s in general [3], because Kϕ is equivalent to proving that (¬Kϕ) is a tautology. But, (¬K) is a DNF, due to the D’Morgan law, that is distributed on a CNF ϕ, and then (¬Kϕ) generates a DNF. And the tautology problem on a DNF is a classic Co-NP-complete problem. In particular, a formula K in 3-DNF can be written as Kϕ with ϕ=false and K=¬K a 3-CF. Then, any algorithm for deciding Kϕ also determine the tautologicity of K, therefore Kϕ is a Co-NP-complete even if K is a 3-CNF.

The fragment of propositional logic in which Kϕ is known to have a polynomial-time decidable method is when both K and ϕ are Horn formulas. For this case, there exist linear-time procedures for deciding Kϕ [8, 11]. However, adding 2-CNF formulas as extensions of Horn formulas would change the inference procedure into an exponential-time complexity process on the number of Horn inferences to perform.

For example, let (KH) be an input formula, where K is a Horn formula and H is a monotone 2-CNF, and let ϕ be a Horn formula. If we want to decide (KH)ϕ, then we could apply the distributive property on each monotone positive binary clause (xy)H and the Horn part K. Therefore, K(xy)ϕ if and only if (¬(K(xy))ϕ) is valid, and it holds if and only if ((¬K(¬x¬y))ϕ)(((¬K¬x)(¬K¬y))ϕ)((¬(Kx)¬(Ky))ϕ)(¬(Kx)ϕ)(¬(Ky)ϕ)((Kx)ϕ)((Ky)ϕ).

Thus, for each positive monotone binary clause, we duplicate the number of Horn inferences to perform. If we consider the existence of two monotone binary clauses in H, that is (K(x1,y1)(x2,y2))ϕ, and we apply the distribution on literals of the monotone clauses, then we obtain four Horn inferences: ((Kx1x2)ϕ), ((Kx1y2)ϕ), ((Ky1x2)ϕ) and ((Ky1y2)ϕ). If there are m positive monotone binary clauses (xiyi), i=1,,m in H, we would have under the above reduction, a total of 2m Horn inferences, type: (H(x1y1)(xmym))ϕ. which leads to an exponential-time complexity process on the number of Horn inferences to perform.

This exponential growth on the Horn inference, when positive monotone clauses are been considered, has been one of the limitations in the development of disjunctive logic programming software. One of the researching lines for tackling the time-complexity of non-Horn logic programming has been to compile the knowledge base and new information into more simple forms, for example, using implicant prime forms [14].

The principle of resolution has been a practical method to check unsatisfiability between conjunctive forms. However, the inference based on resolution method has intrinsic limitations [4].

Despite of the methods of refutation commonly used in the Horn inference, here we consider other kind of methods to determine whether Kϕ. For the fragment of CNF’s, our method focuses on checking that FAL(ϕ)FAL(K) in order to prove Kϕ.

Let us consider from now on that υ(ϕ)υ(K). Let lLit(K). We determine the sets: Kl, K¬l, and K0 formed by the clauses from K containing l, l¯ and neither l nor l¯, respectively. We define also K(l)={D:(Dl)Kl}. Let K=K(l)K0. Notice that in this case, K=K[l¯]. If K is satisfiable, then Kl, because any model m of K can be extended as m{l¯} that is a model for K that falsifies l. Otherwise, Kl, because all falsifying assignment for l also falsifies K.

Lemma 6. Let K be a formula in the fragment of Krom or Horn or Monotone, and let s be a partial assignment defined on υ(K), then K[s] continues as a Krom, or Horn or Monotone formula, respectively.

Proof. Note that for the fragment considered in this lemma, K can also be seen as a CNF, K=i=1mCi. Let s be a partial assignment of K. Let K=i=1mCi[s], the resulting conjunctive form from K[s]. C[s] does not increment the length |C| neither change the parity of literals.

Thus, if K is in the fragment of Krom or Horn or Monotone, then K continues in the same logic fragment of K.

The following theorem shows that the computational complexity to determine Kϕ, when K is in the fragment of Krom or Horn or Monotone is related to the computational complexity of SAT(K).

Theorem 2. Let ϕ be a CNF and let K be a formula in the fragment Krom or Horn or Monotone. For this fragment of propositional formulas, Kϕ is decided in polynomial-time.

Proof. We present as proof, a polynomial-time algorithm.

For each φiϕ

{ Let si=Fals(φi). Let Ki=UP(K,si).

If (SAT(Ki)) then Kϕ /*Because any model m of Ki can be extended as msi that is a model for

K but it falsifies ϕ */.

}

Returns(Kϕ) /*Because FAL(ϕ)FAL(K) */

The loop consists of at most |ϕ| iterations, proving in each step: SAT(Ki).

This is decided in polynomial-time since SAT(Ki) is in the complexity class P for formulas Ki in the fragment Krom or Horn or Monotone formulas.

Thus, the total time complexity of the procedure is polynomial.

From the previous theorem, we delimit the frontier between tractable and intractable instances for Kϕ, being K and ϕ CNF’s. We have shown that Kϕ is solved in polynomial-time when K is a 1-CNF or a 2-CNF. Meanwhile, Kϕ is a Co-NP-complete problem even if K is a 3-CNF.

4 An Exact Algorithm for Kϕ, when K and ϕ are CNF’s

We will present in this section a general method for checking Kϕ, when K and ϕ are two CNF’s. Since K and ϕ are CNF’s, then FAL(ϕ) and FAL(K) can be denoted through the falsifying strings of their clauses. When Kϕ, then FAL(ϕ)FAL(K).

In this case, FAL(ϕ)FAL(K)0 and this implies the existence of a set of assignments S in which SFAL(ϕ) and SFAL(K). Then, an algorithm for checking Kϕ could consists in computing FAL(ϕ)FAL(K). Assuming K=i=1mCi, ϕ=i=1kφi, we want to determine:

ik:(Si=FAL(φi)j=1mFAL(Cj)). (2)

We have designed a procedure to compute FAL(φi)FAL(K) based on the application of the independence property introduced by Dubois [9].

Definition 1. Given two clauses Ci and Cj, if they have at least one complementary literal, it is said that Ci and Cj are independent. Otherwise, we say that both clauses are dependent.

Definition 1 can be written in terms of falsifying strings as follows:

Given two falsifying strings A=Fals(Ci) and B=Fals(Cj) each one of length n, if there is an in such that A[i]=x and B[i]=1x, x{0,1}, then the clauses Ci, Cj (as well as its falsifying strings) have the independence property. Otherwise, we say that both clauses (strings) are dependent.

This means that the falsifying strings for independent clauses have complementary values (0 and 1) in at least one of their fixed values.

Let K={C1,C2,,Cm} be a CNF of m clauses. K is called independent if each pair of clauses Ci, CjK, ij has the independence property. Otherwise, K is called dependent.

Let F={C1,C2,,Cm} be a CNF with m clauses defined on n=|υ(F)| variables. Let Ci, im be a clause in F such that |Ci|<n, and x(υ(F)υ(Ci)) be any variable. We have that:

Ci(Cix¯)(Cix). (3)

Definition 2. Given a pair of dependent clauses C1 and C2, if Lit(C1)Lit(C2) then we say that C2 is subsumed by C1.

If C1 subsumes C2, then FAL(C2)FAL(C1). On the other hand, if C2 is not subsumed by C1 and they are dependent, there is a set of indices I={1,,p}{1,,n} such that for each iI, xiC1, but xiC2. There exists a reduction to make C2 independent from C1. We call this transformation the independent reduction between two clauses, and it works as follows. Let C1 and C2 be two dependent clauses.

Let {x1,x2,,xp}=Lit(C1)\Lit(C2). By (3) we can write: C1C2C1(C2¬x1)(C2x1). Now C1 and (C2¬x1) are independent. Applying (3) to (C2x1)

C1C2C1(C2¬x1)(C2x1¬x2)(C2x1x2).:

The first three clauses are independent. If we repeat the above process of making the last clause independent from the previous clauses until xp is achieved, then (C1C2) is equivalent to the following set of independent clauses: C1(C2¬x1)(C2x1¬x2)(C2x1x2¬xp)(C2x1x2xp).

The last clause contains all literals of C1, so it is subsumed by C1, and then:

C1C2C1(C2¬x1)(C2x1¬x2)(C2x1x2¬xp). (4)

We obtain on the right side of (4) an independent set of p+1 clauses. We denote this independence reduction as ind_reduct(C1,C2). We will use the independent reduction between two clauses C and φ (or between their respective falsifying strings) in order to define:

Ind(C,φ)={φIf φ and C are independent,0If φ is subsumed by C,ind_reduct(C,φ)C Otherwise. (5)

The following theorem shows that the independent operator (5) builds a set of clauses, which covers exactly the space allocations that conforms FAL(φi)FAL(Cj).

Theorem 3. Let φ and C be two clauses, then FAL(Ind(C,φ))=FAL(φ)FAL(C).

Proof. If Ind(C,φ)=0, then FAL(φ)FAL(C). Therefore, FAL(φ)FAL(C)=0. Now, we assume that Ind(C,φ)0. Let s be an assignment such that sFAL(Ind(C,φ)). We will show that sFAL(φ) and sFAL(C). If sFAL(Ind(C,φ)), then s falsifies φ because each clause in Ind(C,φ) has the form (φR) where R is a disjunction (R could be empty, for example in the case Ind(c,φ)=0). If s falsifies (φR), then s has to falsify φ, and thus sFAL(φ).

On the other hand, each clause (φR)Ind(C,φ) is independent from C because of the construction of the operator Ind; therefore, FAL(C)FAL(Ind(C,φ))=0. Thus, sFAL(C).

Theorem 4. (CInd(C,φ))φ.

Proof. If φ and C are independent, then Ind(C,φ)=φ. Therefore, (CInd(C,φ))(Cφ)φ by the propositional property (pq)q and by reflexivity qq. Otherwise, we assume (CInd(C,φ))(Cφ) by Equation 4, and by the property (Cφ)φ, then the theorem holds.

Let φ be a clause, and K=j=1mCj. If we apply the Ind operator between each Cj and φ, we get as result Si. The union of each Si, S=i=1mSi holds that SFAL(φ) and SFAL(K). The pseudo-code for computing Ind(K,φ) is shown in the Algorithm 1.

Algorithm 1 Procedure Ind(K,ϕ) 

In order to generate a minimum set of independent clauses as a result of Ind(K,φ) it is crucial to sort the clauses CjK in ascending order according to the length |Sj|=|Lit(Cj)Lit(φ)|. This is done since the number of literals in Cj, different to the literals in φ, determine the number of independent clauses to be generated. Hence, we have a strategy for reducing the number of independent clauses to be generated by each Ind(Cj,φ)CjK.

The operator Ind applied on the clause φ, and on each one of the clauses CjK, allows us to build the space FAL(φ)FAL(K). Thus, the following recurrence is defined as: A1=φ, Aj+1=Ind(Cj,Aj).

In order to perform Ind(Cj,Aj), the remaining clauses in ClK, l=j+1,,m (those that are not reduced independently with Aj) are sorted again in ascending order according to the number of common literals between the literals represented by Aj.

The above process can be extended to each φiϕ, i=1,,k, as follows:

Ai,1=φi.

Ai,j+1=Ind(Cj,Ai,j), j=1,,m and i=1k.

The clauses Ai,m+1 comply with i=1k(Ai,m+1)=FAL(ϕ)FAL(K). These strings Ai,j, i=1,,k, j=1,,m form a matrix of strings, as it is illustrated in Table 1. Notice that if Ai,j=0, then Ai,l=0, for l=j+1,,m.

Table 1 Computing Ind(K,ϕ) 

FAL(φ1) FAL(K)
**01*** *10**** ****01* *****00 1*****0 0*****0 00*****
*1**0* **1**0* **1**0* **1**01 **1**01 **1**01 **1**01 1*1**01
011**01
FAL(φ2) FAL(K)
*****00 *00**** 0*****0 1*****0 ****01* *10**** **01***
0***10 *0***10 10***10 10***10 Kφ2
FAL(φ3) FAL(K)
****01* **01*** 1*****0 00***** 0*****0 *10**** *****00
0**00** 0**000* 0**000* 0**000* 01*000* 01*0001 0110001 0110001

Example 2. Let us illustrate our procedure on K a 2-CNF and a general CNF ϕ. Let K={(x1,x2),(x1,x7),(x¯1,x7),(x¯2,x3),(x3,x¯4),(x5,x¯6),(x6,x7)} and ϕ=φ1φ2φ3={(x¯3,x6),(x2,x¯6,x7),(x1,x4,x5)}.

In each cell of the Table 1, the result of Ind(Cj,φi) is shown until we determine Kφi,i=1,,3. Although Kφ2, the procedure reports that Kϕ, because of Kφ1 and Kφ3. However, our procedure also builds a set of independent clauses whose falsifying assignments cover exactly the set of models of K, which are not models for φ1 and φ3. This is shown in the last column of Table 1.

As a result of Table 1, let H=Ind(K,ϕ)={(x¯1,x¯3,x6,x¯7),(x1,x¯2,x¯3,x6,x¯7),(x1,x¯2,x¯3,x4,x5,x6,x¯7)}. Notice that KH continues being a CNF. The new CNF H holds FAL(H)FAL(ϕ). Furthermore, FAL(H) represents the minimum set of models for K that are not models for ϕ, since FAL(H)=FAL(ϕ)FAL(K). Therefore, we have that (KH)ϕ by Theorem 4. Although K and ϕ are 2-CNF’s, H=Ind(K,ϕ) could not be a 2-CNF, which means that our procedure is not closed under 2-CNF’s.

4.1 Time-Complexity Analysis

Given K and ϕ two conjunctive normal forms, the time-complexity of our method that checks Kϕ depends on the maximum number of clauses that can be generated through Ind(K,φi) for each φiϕ. Ind(K,φi) generates the empty set in some cases (when Kφi). However, in the worst case, the time complexity for calculating Ind(K,φi) depends on the length of the sets: Sij={x1,x2,,xp}=Lit(Cj)Lit(φi), j=1,,m.

In order to simplify our analysis, let us consider as first case when K is a strict 3-CNF. For this case, Kϕ is an intractable problem. As it was previously mentioned, given φiϕ, the sets Sij=Lit(Cj)Lit(φi), j=1,,m are sorted in ascending order on the number of literals. The case |Sij|=0 indicates that Cj and φ have the independence property, or that φi is subsumed by Cj. In any case, no new strings are formed by Ind(Cj,φi).

Fals(φi) arranges logical values for a set of variables that do not change value during the process Ind(K,φi); therefore, |Si1|+|Si2|++|Sim|n|φi|. And, in the worst case, Sij={x1,x2}=Lit(Cj)Lit(φi) has two literals, because the case where |Sij|=3 already determines that Kφi (by Theorem 1).

Therefore, Ind(Cj,φi) generates at most two new clauses Ca and Cb holding Ca=(φi¬x1) and Cb=(φix1¬x2). This conforms a Fibonacci sequence on the length of clauses formed by Ind(Cj,φi). Considering x=|φi|, then the number of clauses generated by Ind(K,φi) is modeled by the Fibonacci recurrence: T(x)=T(x+1)+T(x+2).

It is known that the growth of the Fibonacci sequence T(n) is upper bounded by Φn1, with Φ=1+52 - known as the “golden ratio”.

Let us consider Poly(n,m) as a polynomial function that represents the computational time spent in sorting the clauses in Sij, to review for subsumed clauses and to perform the independence reduction between two clauses.

Thus, when K is a 3-CNF, the time complexity in the worst case for checking Kφi has an upper bound of O(Φn|φi|Poly(n,m)), where Φ is the “golden ratio”, and n=|υ(K)|.

If Kϕ, then Ind(K,ϕ) allows to build a new CNF whose falsifying assignments cover FAL(ϕ)FAL(K) exactly. Consequently, in this way the initial inference is repaired by (KInd(ϕ,K))ϕ. Repairing the initial inference problem is relevant for different problems in automatic reasoning. For example, in propositional belief revision [7], as well as other automatic reasoning problems between conjunctive forms.

5 Conclusion

The inference problem is key to improve automatic reasoning methods. We show the existence of polynomial-time inference methods for some fragments (apart from the Horn fragment) of propositional logic. For example, we have shown that if K is expressed via a 2-CNF and ϕ is a CNF without restrictions, then the propositional inference problem Kϕ is solved in polynomial-time.

Furthermore, given two CNF’s K and ϕ, our proposal to check Kϕ builds a set of independent clauses S such that the falsifying assignments of S are exactly the subset of models of K, which are not models for ϕ.

As a result, this builds the set S of necessary clauses that repair the inference problem, this is (SK)ϕ. This is key in applications of automatic reasoning on propositional formulas.

References

1. Arad, I., Santha, M., Sundaram, A., Zhang, S. (2019). Linear-time algorithm for quantum 2sat. Theory of Computing, Vol. 14(1), pp. 1–27. [ Links ]

2. Aspval, B., Plass, M., Tarjan, R. (1979). A linear-time algorithm for testing the truth of certain quantified boolean formulas. Information Processing Letters, Vol. 8(3), pp. 121–123. [ Links ]

3. Beyersdorff, O., Meier, A., Thomas, M., Vollmer, H. (2009). The complexity of propositional implication. Information Processing Letters, Vol. 109(18), pp. 1071–1077. [ Links ]

4. Bordeaux, L., Hamadi, Y., Zhang, L. (2006). Propositional satisfiability and constraint programming: A comparative survey. ACM Computing Surveys, Vol. 38, pp. 1–54. [ Links ]

5. Buresh-Oppenheim, J., Mitchell, D. (2007). Minimum 2cnf resolution refutations in polynomial time. Proc. SAT’07 - 10th int. Conf. on Theory and applications of satisfiability testing, LNCS, pp. 300–313. [ Links ]

6. Dahllöf, V., Jonsson, P., Wahlström, M. (2005). Counting models for 2sat and 3sat formulae. Theoretical Computer Science, Vol. 332(1-3), pp. 265–291. [ Links ]

7. De-Ita, G., Marcial, R., Bello, P., Contreras, M. (2018). Belief revisions between conjunctive normal forms. Journal of Intelligent & Fuzzy Systems, Vol. 34, pp. 3155–3164”. [ Links ]

8. Dowling, W., Gallier, J. (1984). Linear-time algorithms for testing the satisfiability of propositional horn formulae. Journal of Logic Programming, Vol. 1(3), pp. 267–284. [ Links ]

9. Dubois, O. (1991). Counting the number of solutions for instances of satisfiability. Theoretical Computer Science, Vol. 81, pp. 49–64. [ Links ]

10. Ellis, D. (2010). Irredundant families of subcubes. Mathematical Proc. of the Cambridge Philosophical Society, Cornell University, pp. 1–24. [ Links ]

11. Gallier, J. (2003). Logic for Computer Science, chapter Foundations of Automatic Theorem Proving (chapter 9). University of Pennsylvania, Department of Computer and Information Science, pp. 410–447. [ Links ]

12. Gusfield, D., Pitt, L. (1992). A bounded approximation for the minimum cost 2-sat problem. Algorithmica, Vol. 8, pp. 103–117. [ Links ]

13. Jansana, R. (2011). Propositional Consequence Relations and Algebraic Logic. Edward N., Zalta (ed.). [ Links ]

14. Marchi, J., Bittencourt, G., Perrusssel, L. (2010). Prime forms and minimal change in propositional belief bases. Ann. Math. Artif. Intelligence, Vol. 59, pp. 1–45. [ Links ]

15. Moshman, D. (2004). From inference to reasoning: The construction of rationality. Thinking & Reasoning, Vol. 10(2), pp. 221–239. [ Links ]

16. Pozos-Parra, M., Weiru, L., Perrussel, L. (2013). Dalal’s revision without hamming distance. Lecture Notes in Artificial Intelligence, Vol. 8265, pp. 41–53. [ Links ]

17. Roth, D. (1996). On the hardness of approximate reasoning. Artificial Intelligence, Vol. 82, pp. 273–302. [ Links ]

18. Shankar, N. (1997). Cambridge Tracks in Theoretical Computer Science No. 38. Cambridge University Press. [ Links ]

19. Zhang, H., Stickel, M. (1996). An efficient algorithm for unit-propagation. Fourth Int. Symposium on Artificial Intelligence and Mathematics, Fort Lauderdale, pp. 166–169. [ Links ]

Received: July 24, 2021; Accepted: September 15, 2021

* Corresponding author: Guillermo De Ita, e-mail: deitaluna63@gmail.com

Creative Commons License This is an open-access article distributed under the terms of the Creative Commons Attribution License