A Syntactic Approach to Studying Strongly Equivalent Logic Programs
aa r X i v : . [ c s . L O ] N ov Under consideration for publication in Theory and Practice of Logic Programming A Syntactic Approach to Studying Strongly EquivalentLogic Programs
Bin Wang, Runqiu Hu, Shutao Zhang, Zhizheng Zhang
School of Computer Science and Engineering, Southeast University, China ( e-mail: { kse.wang, hrqnanjing, shutao zhang, seu zzz } @seu.edu.cn ) submitted 10 November 2020; revised **** ; accepted **** Abstract
In the field of Answer Set Programming (ASP), two logic programs are strongly equivalent if they areordinarily equivalent under any extensions. This property provides a theoretical foundation for studyingmany aspects of logic programs such as program simplification and transformation etc. Therefore, strongequivalence has been investigated extensively for ASP and its extensions such as LP
MLN . In this paper, wepresent a syntactic approach to studying the strong equivalence of logic programs, which provides severalinteresting results and would help us understand the strong equivalence from a new perspective. Firstly, wepresent the notions of independent sets and five kinds of syntactic transformations (S-* transformations)for logic programs. And we investigate the strong equivalence (SE) and non-strong equivalence (NSE)preserving properties of the S-* transformations in the contexts of ASP and LP
MLN . Secondly, based onthe properties of the S-* transformations, we present a fully automatic algorithm to discover syntacticconditions that preserve strong equivalences (SE-conditions) of ASP and LP
MLN programs. To discover theSE-conditions efficiently, we present four kinds of approaches to improve the algorithm. Thirdly, we presenta preliminary method to simplify the discovered SE-conditions and report the simplified SE-conditions ofseveral kinds of LP
MLN programs. After that, we present a discussion on the discovered SE-conditions andsome existing problems. Finally, we present a comparison between SE-conditions discovering approachesin this paper and in the related work.
KEYWORDS : LP
MLN , Strong Equivalence, Syntactic Condition.
In the field of Answer Set Programming (ASP) (Gelfond and Lifschitz 1988), the notions ofstrong equivalences have been extensively investigated for ASP and its extensions, since thesenotions provide a theoretical foundation for studying many aspects of logic programs such as pro-gram simplification and transformation (Eiter et al. 2004; Ji et al. 2015; Cabalar and Ferraris 2007).Roughly speaking, two ASP programs P and Q are strongly equivalent, if for any ASP program R , the extended programs P ∪ R and Q ∪ R have the same stable models, which means the pro-grams P and Q can be replaced each other without considering its context R . To check the strongequivalence of ASP programs, a model-theoretical approach was presented (Lifschitz et al. 2001;Turner 2001), i.e. two ASP programs are strongly equivalent iff they have the same models in thelogic of Here-and-There (HT-models).Besides the model-theoretical approach, several syntactic strong equivalence conditions (SE-conditions for short) are presented to check the strong equivalence of some classes of ASP pro-grams. For example, the TAUT and CONTRA conditions guarantee the strong equivalence be- B. Wang et al. tween an ASP rule and the empty program (Osorio et al. 2002; Lin and Chen 2007). The NON-MIN, WGPPE, S-HYP, and S-IMP conditions can be used to check the strong equivalence of ASPprograms P and P ∪ { r } (Wang and Zhou 2005; Wong 2008), where r is an ASP rule. Usually,an SE-condition can only guarantee the strong equivalence of a kind of logic programs. To studythe SE-conditions of arbitrary ASP programs, Lin and Chen (2007) present a computer-aided ap-proach to discovering SE-conditions of k - m - n problems for ASP. The k - m - n problems are to findthe SE-conditions of the ASP programs K ∪ M and K ∪ N , where K , M , N are pairwise disjointASP programs containing k , m , and n rules respectively. Specifically, Lin and Chen’s approachconjectures a candidate syntactic condition and verifies whether the condition is an SE-condition,where part of the verification can be done automatically, and other steps in the approach have tobe done manually. By the approach, Lin and Chen discover the SE-conditions of several small k - m - n problems in ASP. An application of the SE-conditions is to simplify logic programs, Eiteret al. (Eiter et al. 2004) present an approach to simplifying ASP program via using existing SE-conditions. To study the SE-conditions based simplifications of other logic formalisms, we needto study the SE-conditions of these logic formalisms. In this paper, we study the SE-conditionsof LP MLN programs.LP
MLN (Lee and Wang 2016) is a logic formalism that handles probabilistic inference and non-monotonic reasoning by combining ASP and Markov Logic Networks (MLN) (Richardson and Domingos 2006).Recently, Lee and Luo (2019) and Wang et al. (2019b) have investigated the notions of strongequivalences for LP
MLN programs, respectively. In their work, several theoretical results includ-ing concepts of strong equivalences and corresponding model-theoretical characterizations arepresented. Among these results, we specially focus on the notion of semi-strong equivalence(i.e. the structural equivalence in Lee and Luo’s work), due to the notion is a basis for investi-gating other kinds of strong equivalences of LP
MLN . Similar to the strong equivalence in ASP,semi-strongly equivalent LP
MLN programs have the same stable models under any extensions,and it can be characterized by HT-models in the sense of LP
MLN . However, the SE-conditionsof LP
MLN programs have not been investigated systematically. A possible way to study the SE-conditions of LP
MLN programs is to adapt Lin and Chen’s approach to LP
MLN . But in Lin andChen’s approach, the conjecture and part of the verification have to be done manually, whichmakes it nontrivial to find the SE-conditions.In this paper, we present a novel framework to studying the strong equivalences of logic pro-grams. Based on the framework, we present a fully automatic approach to discovering the SE-conditions of logic programs. Note that a logic program is either an ASP program or an LP
MLN program throughout the paper. Our main work is divided into four aspects.Firstly, we present the notions of independent sets and S-* transformations. An independentset of logic programs is a special kind of set of atoms occurred in the programs. We show thatthere is a one-to-one mapping from logic programs and their independent sets, which means theprograms can be transformed by changing their independent sets. Following the idea, we presentfive kinds of syntactic transformations (S-* transformations) that can transform logic programsby replacing, adding, and deleting atoms in corresponding independent sets. And we investigatethe properties of S-* transformations w.r.t. strong equivalences, i.e., whether S-* transforma-tions preserve strong equivalences and non-strong equivalences of logic programs, called theSE-preserving and NSE-preserving properties.Secondly, we present a fully automatic approach to discovering SE-conditions of logic pro-grams. Based on the SE-preserving and NSE-preserving properties of S-* transformations, wepresent the notion of independent set conditions (IS-conditions) and show that an IS-condition is
Syntactic Approach to Studying Strongly Equivalent Logic Programs k - m - n prob-lems through automatically enumerating and verifying their IS-conditions. After that, we presentfour kinds of methods to improve the basic algorithm. Experiment results show that these algo-rithms are efficient to discover SE-conditions of several small k - m - n problems in LP MLN .Thirdly, we report the discovered SE-conditions of some k - m - n problems of LP MLN . Sincethere are too many SE-conditions discovered by the algorithms, we present a preliminary methodto simplify the SE-conditions and report the simplified SE-conditions. Then, we present a dis-cussion w.r.t. the discovered SE-conditions from two aspects. Firstly, we report two interestingfacts w.r.t. the discovered SE-conditions and discuss potential application and possible theo-retical foundation of the facts. Secondly, we present some problems on the simplifications ofSE-conditions.Finally, we present a comparison between Lin and Chen’s and our approaches, which showsthe advantage of our approach. Our contributions of the paper are two-fold. On the one hand, wedevelop a fully automatic approach to finding SE-conditions for LP
MLN and ASP, which providesa new example for machine theorem discovering (Lin 2018). On the other hand, the notions ofindependent sets and S-* transformations provide a new perspective to understand the strongequivalences of logic programs. Especially, two interesting facts reported in this paper implysome unknown theoretical properties of strongly equivalent logic programs.
In this section, we review the syntax, semantics, and strong equivalences of ASP and LP
MLN programs.
An ASP program is a finite set of rules of the form h ∨ ... ∨ h k ← b , ..., b m , not c , ..., not c n . (1)where h s, b s, and c s are atoms, ∨ is epistemic disjunction, and not is default negation. For anASP rule r , we use h ( r ) , pb ( r ) , and nb ( r ) to denote the sets of atoms occurred in head, positivebody, and negative body of r , respectively, i.e., h ( r ) = { h , . . . , h k } , pb ( r ) = { b , . . . , b m } , and nb ( r ) = { c , . . . , c n } . By at ( r ) , we denote the set of atoms occurred in rule r , i.e., at ( r ) = h ( r ) ∪ pb ( r ) ∪ nb ( r ) ; and by at ( P ) , we denote the set of atoms occurred in a program P . , i.e., at ( P ) = ∪ r ∈ P at ( r ) . Based on above notations, a rule r of the form (1) can be abbreviated as h ( r ) ← pb ( r ) , not nb ( r ) . (2)An ASP program is called ground , if it contains no variables. Usually, a non-ground logic pro-gram is considered as a shorthand for the corresponding ground program, therefore, we onlyconsider ground logic programs in this paper.An LP MLN program is a finite set of weighted ASP rules w : r , where r is an ASP rule of theform (1), and w is a real number denoting the weight of rule r . For an LP MLN program P , by P ,we denote the unweighted ASP counterpart of P , i.e. P = { r | w : r ∈ P } , and P is called ground,if its unweighted ASP counterpart P is ground. B. Wang et al.
A ground set X of atoms is called an interpretation in the context of logic programming. Aninterpretation X satisfies an ASP rule r , denoted by X | = r , if X ∩ h ( r ) = /0, pb ( r ) X , or nb ( r ) ∩ X = /0; otherwise, X does not satisfy r , denoted by X = r . For an ASP program P , interpretation X satisfies P , denoted by X | = P , if X satisfies all rules of P ; otherwise, X does not satisfy P ,denoted by X = P . For an interpretation X and an ASP program P , the Gelfond-Lifschitz reduct(GL-reduct) P X is defined as P X = { h ( r ) ← pb ( r ) . | r ∈ P and nb ( r ) ∩ X = /0 } (3)And X is a stable model of P , if X satisfies the GL-reduct P X , and there does not exist a propersubset X ′ of X such that X ′ | = P X . By SM a ( P ) , we denote the set of all stable models of an ASPprogram P .For an LP MLN rule w : r and an interpretation X , the satisfiability relation is defined as X | = w : r if X | = r and X = w : r if X = r . Similarly, for an LP MLN program P , we have X | = P if X | = P and X = P if X = P . By P X , we denote the set of rules of an LP MLN program P that can be satisfiedby an interpretation X , called the LP MLN reduct of P w.r.t. X , i.e. P X = { w : r ∈ P | X | = w : r } .An interpretation X is a stable model of an LP MLN program P if X is a stable model of the ASPprogram P X . By SM m ( P ) , we denote the set of all stable models of an LP MLN program P . For anLP MLN program P and an interpretation X , the weight degree W ( P , X ) of X w.r.t. P is defined as W ( P , X ) = exp (cid:0) ∑ w : r ∈ P X w (cid:1) . Example 1
Consider an LP
MLN program P = { a . a ← b . ← a , not c . } and an interpretation X = { a } .It is easy to check that P X = { a . a ← b . ← a . } and X = P X , therefore, we have X SM a ( P ) .While under the semantics of LP MLN , (cid:0) P X (cid:1) X = { a . a ← b . } , it is clear that X ∈ SM m ( P ) and W ( P , X ) = e .The weight degree is a kind of uncertainty degree of a stable model, there are other kinds ofuncertainty degrees in LP MLN , which is used in probabilistic inferences. In this paper, we focuson the logical aspect of LP
MLN , therefore, we omit the probabilistic inference part of LP
MLN forbrevity.
Firstly, we review the definitions of strong equivalences in ASP and LP
MLN (Lifschitz et al. 2001;Lee and Luo 2019; Wang et al. 2019b).
Definition 1 ( Strong Equivalence for ASP )For ASP programs P and Q , they are strongly equivalent, denoted by P ≡ s , a Q , if for any ASPprogram R , SM a ( P ∪ R ) = SM a ( Q ∪ R ) . Definition 2 ( Strong Equivalences for LP
MLN )For LP
MLN programs P and Q , we introduce two kinds of notions of strong equivalences: • the programs are semi-strongly equivalent or structural equivalent, denoted by P ≡ s , s Q , iffor any LP MLN program R , SM m ( P ∪ R ) = SM m ( Q ∪ R ) ; Syntactic Approach to Studying Strongly Equivalent Logic Programs • the programs are are w-strongly equivalent, denoted by P ≡ s , w Q , if for any LP MLN pro-gram R , SM m ( P ∪ R ) = SM m ( Q ∪ R ) , and for each stable model X ∈ SM m ( P ∪ R ) , W ( P ∪ R , X ) = W ( Q ∪ R , X ) .For LP MLN programs P and Q , it is clear that P ≡ s , w Q implies P ≡ s , s Q , which means the semi-strong equivalence is a foundation of the w-strong equivalence. Similarly, other kinds of strongequivalences involving uncertainty degrees are based on the semi-strong equivalence, therefore,we first study the syntactic conditions of semi-strongly equivalent LP MLN programs. For simplic-ity, in rest of the paper, we omit the weights of LP
MLN rules and regard an LP
MLN program P asits unweighted ASP counterpart, i.e. P = P .Secondly, we review the HT-model based approaches that characterize the strong equivalencesof ASP and LP MLN . Definition 3 ( HT-Interpretation )An HT-interpretation is a pair ( X , Y ) of interpretations such that X ⊆ Y , and ( X , Y ) is called totalif X = Y , otherwise, it is called non-total. Definition 4 ( HT-Models for ASP )An HT-interpretation ( X , Y ) satisfies an ASP rule r , denoted by ( X , Y ) | = r , if Y | = r and X | = { r } Y ; ( X , Y ) is an HT-model of an ASP program P , denoted by ( X , Y ) | = P , if ( X , Y ) satisfies allrules of P . By HT a ( P ) , we denote the set of all HT-models of the ASP program P . Definition 5 ( HT-Models for LP
MLN )An HT-interpretation ( X , Y ) satisfies an LP MLN rule r , denoted by ( X , Y ) | = r , if Y | = r and X | = { r } YY ; ( X , Y ) is an HT-model of an LP MLN program P , denoted by ( X , Y ) | = P , if ( X , Y ) satisfies all rules of P . By HT m ( P ) , we denote the set of all HT-models of the LP MLN program P .Based on the above definitions, Proposition 1 shows a property of HT-models, and Theorem 1shows the characterizations of the strong equivalences reviewed in this section. Proposition 1
For a logic program P and an HT-model ( X , Y ) of P , if a is an atom such that a at ( P ) , both ofHT-interpretations ( X , Y ∪ { a } ) and ( X ∪ { a } , Y ∪ { a } ) are HT-models of P . Theorem 1
For logic programs P and Q , • P ≡ s , a Q iff HT a ( P ) = HT a ( Q ) ; • P ≡ s , s Q iff HT m ( P ) = HT m ( Q ) ; and • P ≡ s , w Q iff HT m ( P ) = HT m ( Q ) and for any interpretation X , W ( P , X ) = W ( Q , X ) .Finally, we show an example of SE-conditions of ASP and LP MLN programs. For a pair P and Q of logic programs, a syntactic condition C for the programs is a formula w.r.t. the prop-erties and relationships among the sets of head, positive body, and negative body of each rulein the programs. A syntactic condition C is called an SE-condition , if for any programs P and Q satisfying the condition C , P and Q are strongly equivalent or semi-strongly equivalent; oth-erwise, it is called a non-SE-condition . For example, ASP programs P = { r } and /0 are stronglyequivalent iff the condition in Equation (4) is satisfied, which is called TAUT and CONTRA(Osorio et al. 2002; Lin and Chen 2007). ( h ( r ) ∪ nb ( r )) ∩ pb ( r ) = /0 (4) B. Wang et al. LP MLN programs P = { r } and /0 are semi-strongly equivalent iff the condition in Equation (5) issatisfied (Wang et al. 2019b). ( h ( r ) ∪ nb ( r )) ∩ pb ( r ) = /0 or h ( r ) ⊆ nb ( r ) (5)Therefore, Equation (4) and (5) are SE-conditions in ASP and LP MLN , respectively.
In this section, we present a novel approach to studying the strong equivalences of logic pro-grams. Firstly, we present the notion of independent set. Secondly, we present the notions of S-*transformations. Thirdly, we show the properties of the S-* transformations w.r.t. the stronglyequivalences of logic programs.
For convenient description, a logic program P can be regarded as a tuple of rules, i.e., P = h r , ..., r n i , where r i is the i -th rule of the program P . Meanwhile, we treat a tuple as an orderedset that may have the same elements, therefore, some notations of sets are used for tuples inthis paper. For example, for a tuple T , we use e i ∈ T to denote e i is the i -th element of T ,and we use | T | to denote the number of elements of T . For logic programs P = h r , ..., r n i and Q = h t , ..., t m i , the pair h P , Q i is the concatenation of P and Q , i.e. h P , Q i = h r , ..., r n , t , ..., t m i .And a tuple T = h P , ..., P n i of logic programs can be recursively defined as h P , ..., P n i = hh P , ..., P n − i , P n i (6)Based on the above notations, a tuple T of logic programs is regarded as an ordered list of rules.For a rule r of the form (1), it can be represented as a tuple of sets: head h ( r ) , positive body pb ( r ) , and negative body nb ( r ) . Therefore, a tuple T of logic programs is turned into h h ( r ) , pb ( r ) , nb ( r ) , . . . , h ( r | T | ) , pb ( r | T | ) , nb ( r | T | ) i (7)By T S ( T ) , we denote the tuple of sets of the form (7) for a tuple T of logic programs. It is easyto observe that | T S ( T ) | = ∗ | T | . Now, we define the independent sets of a tuple T of logicprograms. Definition 6 ( Independent Sets )Let T be a tuple of logic programs, N = { i | ≤ i ≤ ∗ | T |} a set of positive integers, and N ′ anon-empty subset of N , the independent set I N ′ w.r.t. T and N ′ is defined as I N ′ = \ i ∈ N ′ S i − [ j ∈ N − N ′ S j (8)where S i ∈ T S ( T ) and S j ∈ T S ( T ) . In Equation (8), we call the set S i ( i ∈ N ′ ) an intersection set(i-set) of I N ′ .By Definition 6, since there are 2 ∗| T | − N , there are 2 ∗| T | − T of logic programs. Intuitively, an independent set I of a tuple T oflogic programs contains atoms that occur in the i-sets of I and do not occur in the other sets of T S ( T ) . It is easy to check that the independent sets w.r.t. T are pairwise disjoint , and all atomsof T appear in independent sets w.r.t. T . Therefore, the independent sets can be viewed as a set Syntactic Approach to Studying Strongly Equivalent Logic Programs T , we assign a label to each independent set as follows. For an independentset I N ′ w.r.t. T and a set N ′ of positive integers, let n = | T | , we use B ( N ′ ) to denote a tuple of 0sand 1s w.r.t. I N ′ , where the k -th element of B ( N ′ ) is 1 if the k -th set S k of T S ( T ) is an i-set of I N ′ ,otherwise, it is 0, which is as follows B ( N ′ ) = ( b , . . . , b ∗| T | ) , where b k = ( S k is an i-set of I N ′ , i.e., k ∈ N ′ ;0 otherwise . (9)Then the tuple B ( N ′ ) can be viewed as a binary number ( b . . . b n ) , which can be observedthat 1 ≤ B ( N ′ ) < ∗| T | . By B ( N ′ , m , n ) (1 ≤ m < n ≤ | B ( N ′ ) | ), we denote the number w.r.t. thesub-tuple of B ( N ′ ) from m to n , i.e., B ( N ′ , m , n ) = ( b m , ..., b n ) where b i ∈ B ( N ′ ) ( m ≤ i ≤ n ).Based on the above notations, we have established a one-to-one mapping from independent setsto positive integers, therefore, we can use I k (1 ≤ k < ∗| T | ) to denote different independent setsw.r.t. a tuple T of logic program, where the number k is called the name of I k . Note that by thedefinition of independent sets, I is not an independent set. For a tuple T of logic programs, by IS ( T ) , we denote the set of names of all independent sets w.r.t. T , i.e. IS ( T ) = { i | ≤ i < ∗| T | } ;by IS e ( T ) and IS n ( T ) , we denote the sets of names of all empty and non-empty independent setsin IS ( T ) , respectively. Example 2
Consider a logic program P = h r i , where rule r is a ∨ b ∨ d ← b , c , not c . (10)we have h ( r ) = { a , b , d } , pb ( r ) = { b , c } , nb ( r ) = { c } , and T S ( P ) = h h ( r ) , pb ( r ) , nb ( r ) i . It iseasy to check that there are seven independent sets w.r.t. P , which are as follows • I = I = nb ( r ) − ( h ( r ) ∪ pb ( r )) = /0, • I = I = pb ( r ) − ( h ( r ) ∪ nb ( r )) = /0, • I = I = ( pb ( r ) ∩ nb ( r )) − h ( r ) = { c } , • I = I = h ( r ) − ( pb ( r ) ∪ nb ( r )) = { a , d } , • I = I = ( h ( r ) ∩ nb ( r )) − pb ( r ) = /0, • I = I = ( h ( r ) ∩ pb ( r )) − nb ( r ) = { b } , and • I = I = h ( r ) ∩ pb ( r ) ∩ nb ( r ) = /0.As shown in Example 2, there are 7 independent sets of a rule. For a rule r k in a tuple T oflogic programs, we use I i ( r k ) (1 ≤ i ≤
7) to denote independent sets of the rule r k . Besides, wedefine the set I ( r k ) w.r.t. the rule r k and the tuple T as I ( r k ) = at ( T ) − ( h ( r k ) ∪ pb ( r k ) ∪ nb ( r k )) (11)where at ( T ) is the set of atoms occurred in the tuple T . By the law of set difference, “ A − B ” isequivalent to “ A ∩ B c ”, where B c is the complementary set of B . Therefore, for an independentset I N ′ of a tuple T of logic programs, Equation (8) can be reformulated as I N ′ = \ ≤ k ≤| T | I i k ( r k ) , where r k ∈ T and i k = B ( N ′ , k − , k ) (12)In Equation (12), we say the independent set I N ′ is composed by I i k ( r k ) , denoted by I N ′ ⊑ I i k ( r k ) .For non-empty independent sets I and I i ( r ) , it is easy to check that I ⊆ I i ( r ) if I ⊑ I i ( r ) and I ∩ I i ( r ) = /0 if I I i ( r ) . B. Wang et al.
Based on the above definitions of independent sets, given all the independent sets w.r.t. a tuple T , we can construct each element S i of the tuple T S ( T ) as follows S i = [ IS ′ , where IS ′ = { I | S i is an i-set of I . } (13)Therefore, there is a one-to-one mapping from a tuple T of logic programs to the independent setsof T . Naturally, a tuple T of logic programs can be transformed by adding, deleting, and replacingatoms of its independent sets, which is the basic idea of the notions of S-* transformations definedin what follows. By transforming the independent sets of a tuple T of logic programs, we can construct a newtuple of logic programs. Here, we present five kinds of ways of transformations, called S-* trans-formations. Definition 7 ( S-* Transformations )Let T be a tuple of logic programs, I k an independent set w.r.t. T , and a ′ a new atom such that a ′ at ( T ) , the S-* transformations are defined as follows • single replacement (S-RP) transformation is to replace an atom a in I k with a ′ , denoted by Γ ± ( I k , a , a ′ ) , where | I k | > • single deletion (S-DL) transformation is to delete an atom a from I k , denoted by Γ − ( I k , a ) ,where a ∈ I k and | I k | > • single reduce (S-RD) transformation is to delete an atom a from I k , denoted by Γ ⊖ ( I k , a ) ,where a ∈ I k and 0 < | I k | ≤ • single addition (S-AD) transformation is to add a ′ to I k , denoted by Γ + ( I k , a ′ ) , where | I k | ≥
2; and • single extension (S-EX) transformation is to add a ′ to I k , denoted by Γ ⊕ ( I k , a ′ ) , where0 ≤ | I k | < T of logic programs, we use Γ ± ( T , I k , a , a ′ ) to denote the tuple obtained from T by an S-RP transformation Γ ± ( I k , a , a ′ ) , and use Γ ◦ ( T , I k , a ) to denote the tuple obtained from T by other S-* transformations Γ ◦ ( I k , a ) , where ◦ ∈ {− , ⊖ , + , ⊕} . For an S-* transformation,we define a series of sub-transformations of S-*, i.e. the S-*-i transformations, where an S-*-itransformation can only be used to operate independent set I such that | I | = i . We use Γ ◦ i ( • ) todenote the results obtained by an S-*-i transformation, where ◦ ∈ {± , − , ⊖ , + , ⊕} and i ≥
0. Itis easy to observe that there are only two sub-transformations of S-EX and S-RD, respectively,i.e. S-EX-0, S-EX-1, S-RD-2, and S-RD-1 transformations.
Example 3
Recall the rule r in Example 2, Table 1 shows different independent sets and rules obtained bythe S-* transformations, where x is a newly introduced atom and I k (1 ≤ k ≤
7) are independentsets of the tuple h r i in Example 2. Now we investigate the properties of S-* transformations w.r.t. the strong equivalences of logicprograms, i.e., the SE-preserving and NSE-preserving properties. For brevity, we focus on theinvestigations for LP
MLN programs, and show there are the same results for ASP programs.Firstly, we define the notions of SE-preserving and NSE-preserving properties.
Syntactic Approach to Studying Strongly Equivalent Logic Programs r by S-* Transformations S-* Γ ◦ ( • ) r ◦ S-RP I ± = Γ ± ( I , c , x ) = { x } a ∨ b ∨ d ← b , x , not x . S-AD I + = Γ + ( I , x ) = { a , d , x } a ∨ b ∨ d ∨ x ← b , c , not c . S-DL ( I + ) − = Γ − ( I + , a ) = { d , x } b ∨ d ∨ x ← b , c , not c . S-RD-1 I ⊖ = Γ ⊖ ( I , b ) = /0 a ∨ d ← c , not c . S-RD-2 I ⊖ = Γ ⊖ ( I , d ) = { a } a ∨ b ← b , c , not c . S-EX-0 I ⊕ = Γ ⊕ ( I , x ) = { x } a ∨ b ∨ d ← b , c , not c , not x . S-EX-1 I ⊕ = Γ ⊕ ( I , x ) = { c , x } a ∨ b ∨ d ← b , c , x , not c , not x . Table 2. Properties of S-* Transformations
S-RP S-DL S-RD-2 S-RD-1 S-AD S-EX-1 S-EX-0SE-preserving (cid:0) LP MLN (cid:1)
Yes Yes Yes No Yes No NoNSE-preserving (cid:0) LP MLN (cid:1)
Yes Yes No No Yes Yes NoSE-preserving ( ASP ) Yes Yes Yes No Yes No NoNSE-preserving ( ASP ) Yes Yes No No Yes Yes No
Definition 8 ( SE-preserving and NSE-preserving Properties )Let the tuple T = h P , Q i be a pair of logic programs and T ◦ = h P ◦ , Q ◦ i a tuple obtained from T by an S-* transformation Γ ◦ ( • ) , where ◦ ∈ {± , + , ⊕ , − , ⊖} . The S-* transformation is called SE-preserving , if P ≡ s , △ Q implies P ◦ ≡ s , △ Q ◦ ; and it is called NSE-preserving , if P s , △ Q implies P ◦ s , △ Q ◦ , where △ ∈ { a , s } .Secondly, we investigate whether an S-* transformation is SE-preserving and NSE-preserving,and we focus on the discussion of S-* transformations in the context of LP MLN . All the main re-sults of this subsection are summarized in Table 2, which will be investigated one by one inwhat follows. To investigate the SE-preserving and NSE-preserving properties of the S-* trans-formations, we should investigate the satisfiability between the HT-interpretations and LP
MLN programs under S-* transformations by Theorem 1, which is the main idea of the investigations.
S-RP Transformation.
For the S-RP transformation, it is clear that there exists a one-to-onemapping from the HT-models of a logic program P to the HT-models of P ± , where P ± is obtainedfrom P by an S-RP transformation. Therefore, we have Theorem 2. Theorem 2
The S-RP transformation is SE-preserving and NSE-preserving in LP
MLN . S-DL Transformation in LP
MLN . For the S-DL transformation, consider an LP
MLN rule r ina tuple T of logic programs and an independent set I w.r.t. T such that | I | ≥
3, suppose rule r − isthe counterpart of r in Γ − ( T , I , a ) . For an HT-interpretation ( X , Y ) such that a Y , Table 3 showsthe satisfiability between ( X , Y ) and rules r and r − under the S-DL transformation, where I i ( r ) means I ⊑ I i ( r ) , “ ∗ ” means ( X , Y ) | = r − or ( X , Y ) = r − , “—” means corresponding case does notexist, X ′ = X ∪ { a } , and Y ′ = Y ∪ { a } . By the results in Table 3, we investigate the SE-preservingand NSE-preserving properties by Lemma 1 and 2, respectively.0 B. Wang et al.
Table 3. Satisfiability between HT-interpretations and Rules under the S-DL Transformation I ⊑ ( X , Y ) | = r ( X , Y ) = r ( X , Y ′ ) | = r ( X , Y ′ ) = r ( X ′ , Y ′ ) | = r ( X ′ , Y ′ ) = rI ( r ) ( X , Y ) | = r − ( X , Y ) = r − ( X , Y ) | = r − ( X , Y ) = r − ( X , Y ) | = r − ( X , Y ) = r − I ( r ) ( X , Y ) | = r − ( X , Y ) = r − ∗ — ∗ — I ( r ) * — ∗ — ( X , Y ) | = r − ( X , Y ) = r − I ( r ) ( X , Y ) | = r − ( X , Y ) = r − ( X , Y ) | = r − ∗ ∗ — I ( r ) ( X , Y ) | = r − ( X , Y ) = r − ∗ — ∗ —Others ( X , Y ) | = r − — ( X , Y ) | = r − — ( X , Y ) | = r − — Lemma 1
The S-DL transformation is SE-preserving in LP
MLN . Proof
Let T = h P , Q i be a pair of logic programs such that P ≡ s , s Q and set I an independent set w.r.t. T such that | I | ≥
3. Suppose independent set I − = Γ − ( I , a ) = I − { a } and T − = h P − , Q − i = Γ − ( T , I , a ) . For a rule r in T , we use r − to denote the counterpart of r in T − . Since the atom a does not occur in P − and Q − , by Proposition 1, we only need to investigate the HT-interpretation ( X , Y ) such that a Y . By Table 3, there are two main kinds of cases. Case 1.
If for arbitrary rule r of T such that I ⊑ I ( r ) , we have ( X , Y ) | = r − . By Table 3,it is easy to check that ( X , Y ) | = r iff ( X , Y ) | = r − for any rule r of T . Since the programs P and Q are semi-strongly equivalent, we have HT m ( P ) = HT m ( Q ) by Theorem 1, which means HT m ( P − ) = HT m ( Q − ) . Therefore, the programs P − and Q − are semi-strongly equivalent. Case 2.
If there exists a rule r of T such that I ⊑ I ( r ) and ( X , Y ) = r − , we show ( X , Y ) isnot an HT-model of the programs P − and Q − . Without loss of generality, suppose r is an LP MLN rule such that r ∈ P . Since I ⊑ I ( r ) and | I | ≥
3, we have I ∩ h ( r ) = /0, I ⊆ pb ( r ) , I ∩ nb ( r ) = /0,and | I − | 6 = /0. Since ( X , Y ) = r − , we have h ( r − ) ∩ X = /0, h ( r − ) ∩ Y = /0, pb ( r − ) ⊆ X ⊆ Y , and nb ( r − ) ∩ Y = /0, which means I − ⊆ X ⊆ Y . Let Y + = Y ∪ { a } and X + = X ∪ { a } , it is easy tocheck that ( X + , Y + ) = r . Since P and Q are semi-strongly equivalent, there must exist a rule t ∈ Q such that ( X + , Y + ) = t , which means h ( t ) ∩ Y + = /0, h ( t ) ∩ X + = /0, pb ( t ) ⊆ X + ⊂ Y + , and nb ( t ) ∩ Y + = /0. Since I ⊆ X + ⊆ Y + , we have I ∩ h ( t ) = /0 and I ∩ nb ( t ) = /0. Either I ⊆ pb ( t ) or I ∩ pb ( t ) = /0, we have pb ( t − ) ⊆ X ⊆ Y , therefore, we have ( X , Y ) = t − , which means ( X , Y ) isnot an HT-model of the programs P − and Q − .Combining above results, for an HT-interpretation ( X , Y ) such that a Y and a rule r , if ( X , Y ) | = r and ( X , Y ) = r − , ( X , Y ) is not an HT-model of the programs P − and Q − ; otherwise,we have ( X , Y ) | = r iff ( X , Y ) | = r − . Since the programs P and Q are semi-strongly equivalent, itis obvious that programs P − and Q − are also semi-strongly equivalent, Lemma 1 is proven. Lemma 2
The S-DL transformation is NSE-preserving in LP
MLN . Proof
Let T = h P , Q i be a pair of logic programs such that P s , s Q and set I an independent set w.r.t. T such that | I | ≥
3. Suppose independent set I − = Γ − ( I , a ) = I − { a } and T − = h P − , Q − i = Γ − ( T , I , a ) . For a rule r in T , we use r − to denote the counterpart of r in T − . Syntactic Approach to Studying Strongly Equivalent Logic Programs P − and Q − are semi-strongly equivalent.Without loss of the generality, suppose ( X , Y ) is an HT-interpretation such that ( X , Y ) | = P and ( X , Y ) = Q . Since P − and Q − are semi-strongly equivalent, there are two kinds of cases w.r.t.the HT-interpretation ( X , Y ) , i.e. (1) ( X , Y ) = P − and ( X , Y ) = Q − , and (2) ( X , Y ) | = P − and ( X , Y ) | = Q − . According to the relationships among the atom a and interpretations X and Y ,there are three kinds of cases: (1) a Y , (2) a X and a ∈ Y , (3) a ∈ X . Therefore, the proofis divided into six main cases. Since the complete proof is tedious, we only show the proof of arepresentative case for brevity, the proofs of other cases are similar. Case 1.
Suppose a Y , ( X , Y ) = P − , and ( X , Y ) = Q − , there is a rule r ∈ P such that ( X , Y ) | = r and ( X , Y ) = r − . By Table 3, the relationship between I and the independent sets of r is I ⊑ I ( r ) , which means I ∩ h ( r ) = /0, I ⊆ pb ( r ) , and I ∩ nb ( r ) = /0. Since ( X , Y ) = r − , we have h ( r − ) ∩ X = /0, h ( r − ) ∩ Y = /0, pb ( r − ) ⊆ X ⊆ Y , and nb ( r − ) ∩ Y = /0, which means I − ⊆ X ⊆ Y .Suppose b ∈ I and b = a , let X ′ = ( X − { b } ) ∪ { a } and Y ′ = ( Y − { b } ) ∪ { a } , since | I | ≥
3, wehave I − ∩ X ′ = /0 and I − X ′ . In rest of the proof, we firstly show ( X ′ , Y ′ ) | = P and ( X ′ , Y ′ ) = Q .Then, we show ( X ′ , Y ′ ) | = P − and ( X ′ , Y ′ ) = Q − .Firstly, since I − ⊆ X ⊆ Y and a Y , we have ( X , Y ) | = t for any rule t such that I ⊑ I i ( t ) and i =
0. Since I − ∩ X ′ = /0 and I − X ′ , it is easy to check that ( X ′ , Y ′ ) | = t for any rule t suchthat I ⊑ I i ( t ) and i =
0. For the rule t such that I ⊑ I ( r ) , since the atoms of I do not appearin t , by Proposition 1, we have ( X , Y ) | = t iff ( X ′ , Y ′ ) | = t . Combining above results, we haveshown that ( X , Y ) | = t iff ( X ′ , Y ′ ) | = t for any rule t in the tuple T , which means ( X ′ , Y ′ ) | = P and ( X ′ , Y ′ ) = Q .Secondly, for rule t of T such that I ⊑ I ( t ) , since t = t − , we have ( X ′ , Y ′ ) | = t iff ( X ′ , Y ′ ) | = t − .For rule t of T such that I ⊑ I ( t ) and i =
0, since I − ∩ X ′ = /0 and I − X ′ , it is easy to check that ( X ′ , Y ′ ) | = t − . Above results show that ( X ′ , Y ′ ) | = t iff ( X ′ , Y ′ ) | = t − for any rule t in the tuple T , which means ( X ′ , Y ′ ) | = P − and ( X ′ , Y ′ ) = Q − . By Theorem 1, we have P − s , s Q − , whichcontradicts with the assumption. Others.
In other cases, it can be shown that either the case does not exist or P − s , s Q − ,therefore, Lemma 2 is proven.In the proof of Lemma 2, it can be observed that | I | ≥ Theorem 3
The S-DL transformation is SE-preserving and NSE-preserving in LP
MLN . S-RD Transformation in LP
MLN . For the S-RD transformation, we discuss the S-RD-1 andS-RD-2 transformations, respectively, which is shown in Theorem 4.
Theorem 4
In LP
MLN , the S-RD-1 transformation is neither SE-preserving nor NSE-preserving; and the S-RD-2 transformation is SE-preserving but not NSE-preserving.The proof of SE-preserving property of S-RD-2 in Theorem 4 is basically the same as theproof of Lemma 1. Example 4 shows that the S-RD-1 transformation is neither SE-preservingnor NSE-preserving in general. And Example 5 shows that the S-RD-2 transformation is notNSE-preserving.2
B. Wang et al.Example 4
Firstly, consider a tuple of LP
MLN rules T = h r i , where r is the rule “ a ∨ c ← b ∨ c . ”. By Equation(5), it is easy to check that the rule r is semi-strongly equivalent to the empty program, i.e. { r } ≡ s , s /0. For the tuple T , the independent set I is I = h ( r ) ∩ pb ( r ) − nb ( r ) = { c } (14)Let T ⊖ = h r ⊖ i = Γ ⊖ ( T , I , c ) , we have the rule r ⊖ is “ a ← b . ”. One can check that { r ⊖ } 6≡ s , s /0,since ( { b } , { a , b } ) = r ⊖ . Therefore, the S-RD-1 transformation is not SE-preserving.Secondly, consider a tuple of LP MLN rules T = h r , r i , where rule r is the rule “ a ∨ b . ”and r is the rule “ b . ”. For the HT-interpretation ( X , Y ) = ( { a } , { a , b } ) , it is easy to check that ( X , Y ) | = r and ( X , Y ) = r , therefore, we have { r } 6≡ s , s { r } . For the tuple T , the independentset I is I = I ( r ) ∩ I ( r ) = h ( r ) − ( pb ( r ) ∪ nb ( r ) ∪ h ( r ) ∪ pb ( r ) ∪ nb ( r )) = { a } (15)Let T ⊖ = h r ⊖ , r ⊖ i = Γ ⊖ ( T , I , a ) , we have the rule r ⊖ is “ b . ” and the rule r ⊖ is the sameas r . It is obvious that r ⊖ is semi-strongly equivalent to the rule r ⊖ . Therefore, the S-RD-1transformation is not NSE-preserving. Example 5
Consider LP
MLN programs P = h r , r i and Q = h r , r , r i P : a ∨ c . ( r ) b . ( r ) Q : a ∨ b ∨ c . ( r ) a ∨ c ← b . ( r ) b ← a , c . ( r ) ⇒ P ⊖ : a . ( r ⊖ ) b . ( r ⊖ ) Q ⊖ : a ∨ b . ( r ⊖ ) a ← b . ( r ⊖ ) b ← a . ( r ⊖ ) For an HT-interpretation ( X , Y ) = ( { a } , { a , b } ) , it is easy to check that ( X , Y ) = P and ( X , Y ) | = Q , which means the programs P and Q are not semi-strongly equivalent. For the tuple T = h P , Q i ,there are only two non-empty independent sets I and I as follows I = I ( r ) ∩ I ( r ) ∩ I ( r ) ∩ I ( r ) ∩ I ( r ) = { a , c } (16) I = I ( r ) ∩ I ( r ) ∩ I ( r ) ∩ I ( r ) ∩ I ( r ) = { b } (17)Let T ⊖ = h P ⊖ , Q ⊖ i = Γ ⊖ ( T , I , c ) , one can check that only the total HT-interpretations areHT-models of the programs P ⊖ and Q ⊖ , which means the programs P ⊖ and Q ⊖ are semi-stronglyequivalent. Therefore, the S-RD-2 transformation is not NSE-preserving.Above results show that singleton independent sets play a different role from other non-emptyindependent sets. For a tuple T of logic programs, we use IS s ( T ) to denote the set of names ofall singleton independent sets of T . S-AD and S-EX Transformations in LP
MLN . For the S-AD and S-EX transformation, it isworth noting that S-AD is the inverse of S-DL and S-EX is the inverse of S-RD, therefore, theSE-preserving and NSE-preserving results of S-AD and S-EX can be derived from Theorem 3and 4 straightforwardly, which is shown in Theorem 5 and 6.
Theorem 5
The S-AD transformation is SE-preserving and NSE-preserving in LP
MLN . Syntactic Approach to Studying Strongly Equivalent Logic Programs Theorem 6
In LP
MLN , the S-EX-0 transformation is neither SE-preserving nor NSE-preserving; and the S-EX-1 transformation is NSE-preserving but not SE-preserving.
S-* Transformations in ASP.
Finally, following the same idea of investigating the propertiesof S-* transformations in LP
MLN , the SE-preserving and NSE-preserving results of S-* transfor-mations in ASP can be obtained. Theorem 7 shows the properties of S-* transformations for ASPprograms are the same as the properties in LP
MLN . Theorem 7
The SE-preserving and NSE-preserving results of S-* transformations in ASP are • the S-RP, S-DL, and S-AD transformations are SE-preserving and NSE-preserving; • the S-RD-2 transformation is SE-preserving but not NSE-preserving; • the S-EX-1 transformation is NSE-preserving but not SE-preserving; and • the S-RD-1 and the S-EX-0 transformations are neither SE-preserving nor NSE-preserving.Now we have shown the SE-preserving and NSE-preserving properties of S-* transformationsin ASP and LP MLN . In next section, we show an application of the properties of S-* transforma-tions, i.e., discovering SE-conditions.
MLN
In this section, we present a fully automatic approach to discovering SE-conditions for LP
MLN programs, which is an application of the independent sets and S-* transformations. Firstly, wepresent the notion of independent set condition (IS-condition) and show the relationships be-tween the notions of SE-condition and IS-condition. Secondly, we present a basic algorithm todiscover SE-conditions of k - m - n problems in LP MLN , which is a direct application of the prop-erties of the S-* transformations. Thirdly, we present four kinds of approaches to improving thebasic algorithm by further investigating the properties of S-* transformations. Finally, we showthe improved algorithm can be used in discovering SE-conditions of several k - m - n problems byan experiment. Here, we define the notion of independent set conditions (IS-conditions) and show the relation-ships between the notions of IS-conditions and SE-conditions.
Definition 9 ( Independent Set Conditions )For a tuple T of logic programs, the independent set condition (IS-condition) IC ( T ) is a conjunc-tive formula IC ( T ) = ^ i ∈ IS n ( T ) ( I i = /0 ) ∧ ^ j ∈ IS e ( T ) ( I j = /0 ) ∧ ^ k ∈ IS s ( T ) ( | I k | = ) (18) Example 6
Recall the program P in Example 2, the IS-condition of P is IC ( P ) = ^ i ∈{ , , } ( I i = /0 ) ∧ ^ j ∈{ , , , } ( I j = /0 ) ∧ ^ k ∈{ , } ( | I k | = ) (19)4 B. Wang et al.
For a tuple T of logic programs, the tuple T is called a singleton tuple if IS s ( T ) = IS n ( T ) ; andthe IS-condition IC ( T ) is called a singleton IS-condition if T is a singleton tuple. For brevity,we associate an IS-condition IC ( T ) with a tuple T of logic programs, and if I k is not a singletonindependent set in the condition, there are at least two atoms in the independent set I k of T . Fortwo tuples of programs T = h P , ..., P n i and T = h Q , ..., Q n i , we say T is structually equal to T ,denoted by T ≈ T , if | P i | = | Q i | (1 ≤ i ≤ n ). For tuples T and T , if T ≈ T , we have IS ( T ) = IS ( T ) , while the inverse does not hold in general. Now we define three kinds of relations betweenIS-conditions. Definition 10 ( Relationships between IS-Conditions )For tuples T and T of logic programs such that T ≈ T , we have • IC ( T ) = IC ( T ) , if IS n ( T ) = IS n ( T ) and IS s ( T ) = IS s ( T ) ; • IC ( T ) < IC ( T ) , if IS n ( T ) = IS n ( T ) and IS s ( T ) ( IS s ( T ) ; and • IC ( T ) ⊂ IC ( T ) , if IC ( T ) and IC ( T ) are singleton IS-conditions, and IS n ( T ) ( IS n ( T ) .where A ( B means A is a proper subset of B .Note that IS ( T ) and IS ( T ) are the sets of names of independent set, therefore, IS n ( T ) = IS n ( T ) does not mean T and T have the same independent sets, which means I k is a non-empty inde-pendent set of T iff I k is a non-empty independent set of T for any k ∈ IS ( T ) . By Theorem 2 -7, we have following results. Theorem 8
For tuples of logic programs T = h P , Q i and T = h P , Q i such that T ≈ T , • (I) if IC ( T ) = IC ( T ) , we have P ≡ s , △ Q iff P ≡ s , △ Q ; and • (II) if IC ( T ) < IC ( T ) , we have P s , △ Q implies P s , △ Q ; and P ≡ s , △ Q implies P ≡ s , △ Q ;where △ ∈ { a , s } .Part I of Theorem 8 can be proven by the SE-preserving and NSE-preserving properties of S-RP, S-DL, and S-AD transformations. Since for the tuples T and T such that IC ( T ) = IC ( T ) , T can be obtained from T by using S-RP, S-DL, and S-AD transformations repetitively, and allof the transformations are SE-preserving and NSE-preserving. Similarly, part II of Theorem 8can be proven by properties of S-EX-1 and S-RD-2 transformations.For a tuple T = h P , Q i of logic programs, by Theorem 8, IC ( T ) is an SE-conditions for anytuple T ′ such that T ′ ≈ T , if P ≡ s , △ Q . To verify whether an IS-condition is an SE-condition,we construct a tuple of logic programs satisfying the condition firstly. Then we can comparethe HT-models of the constructed programs. Obviously, the verification of an IS-condition canbe done automatically. An SE-condition IC ( T ) is the most general SE-condition , if there are notuple T ′ = h P ′ , Q ′ i such that IC ( T ) < IC ( T ′ ) and P ′ ≡ s , △ Q ′ . By MGIC ( T ) , we denote the mostgeneral SE-condition w.r.t. a k - m - n tuple T . Part II of Theorem 8 implies a method to computemost general SE-condition, which is shown as follows. Corollary 1
For a tuple T = h P , Q i of LP MLN programs such that IC ( T ) is an SE-condition, there is a tuple T ′ such that T ′ ≈ T and IC ( T ′ ) is the most general SE-condition of T , where IS n ( T ′ ) = IS n ( T ) , IS s ( T ′ ) is constructed as in Equation (20), a ′ is a newly introduced atoms, and △ ∈ { a , s } . IS s ( T ′ ) = { k ∈ IS s ( T ) | T ′ = h P ′ , Q ′ i = Γ ⊕ ( T , I k , a ′ ) and P ′ s , △ Q ′ } (20) Syntactic Approach to Studying Strongly Equivalent Logic Programs
MLN programs, which is shown in nextsubsection.
MLN
Since the IS-conditions can be enumerated and verified automatically, Theorem 8 implies a fullyautomatic method to discover SE-conditions for LP
MLN . Firstly, we introduce the k - m - n problemsfor LP MLN programs, which is presented by Lin and Chen (2007) to study the SE-conditions ofASP programs. A k - m - n tuple is a triple T = h K , M , N i of LP MLN programs such that | K | = k , | M | = m , and | N | = n . A k - m - n tuple T of LP MLN programs is semi-strongly equivalent, if theLP
MLN programs K ∪ M and K ∪ N are semi-strongly equivalent. An SE-condition for a k - m - n problem is called a k - m - n SE-condition. A k - m - n SE-condition is called necessary , if for any k - m - n tuple T ′ that does not satisfy the condition, T ′ is not semi-strongly equivalent. The k - m - n problem is to discover necessary k - m - n SE-conditions of k - m - n tuples. In this paper, it is easy toobserve that discovering necessary k - m - n SE-conditions is to enumerate and verify all possibleIS-conditions of k - m - n tuples. We use IC ( k , m , n ) to denote the set of all singleton IS-conditionsw.r.t. a k - m - n problem. Corollary 2 shows the form of a necessary k - m - n SE-condition, which isa direct result of Theorem 8.
Corollary 2
The necessary k - m - n SE-condition for LP
MLN is a formula in disjunctive normal form (DNF) _ IC ( T ) ∈ IC ( k , m , n ) MGIC ( T ) (21)where MGIC ( T ) is treated as a falsity if IC ( T ) is not an k - m - n SE-condition.According to Theorem 8 and Corollary 1, Algorithm 1 provides a method to verify an IS-condition and compute the most general SE-condition, and Algorithm 2 provides a basic methodto discover necessary k - m - n SE-conditions.For the 0-1-0 problem, Algorithm 2 discovered 120 SE-conditions, which can be viewed as aDNF formula by Corollary 2. A DNF formula of the form ( F ∧ a ) ∨ ( F ∧ ¬ a ) can be simplifiedas F , therefore, the 120 SE-conditions can be simplified as ( I = /0 ) ∨ ( I = /0 ) ∨ ( I = /0 ) ∨ ( I = /0 ) (22)An LP MLN rule r is called semi-valid if it satisfies Equation (22), otherwise, it is called non-semi-valid . The necessary 0-1-0 SE-condition is shown in Equation (5), although Equation (5) is dif-ferent from Equation (22) in form, these two kinds of conditions are equivalent. In addition, sincean LP MLN program can be reduced to ASP programs by using choice rules (Lee and Luo 2019),the necessary 0-1-0 SE-condition for LP
MLN can be proven by necessary 0-1-0 SE-condition forASP. For other k - m - n problems in LP MLN , although the necessary SE-conditions of several k - m - n problems in ASP have been presented (Lin and Chen 2007; Ji 2015), it is not trivial to constructthe necessary k - m - n SE-conditions for LP
MLN by the results in ASP. Therefore, the searchingapproach presented in this section is significant.For other k - m - n problems, Algorithm 2 is computationally infeasible, since the searching spacegrows extremely rapidly. For example, for the 0-1-1 problem, there are 2 ∗ − =
63 independentsets, therefore, Algorithm 2 needs to verify 2 singleton IS-conditions, which is barely possible6 B. Wang et al.
Algorithm 1:
Computing the Most General SE-condition veri f y and compute mg se
Input: the sizes of a k - m - n problem: k , m , n ; andthe names of non-empty and singleton independent sets: IS n , IS s Output: most general SE-conditions: C IS ′ s = /0; construct a k - m - n tuple T = h K , M , N i such that IS n ( T ) = IS n and IS s ( T ) = IS s ; if HT m ( K ∪ M ) = HT m ( K ∪ N ) then for k ∈ IS s ( T ) do construct h K ′ , M ′ , N ′ i = Γ ⊕ ( T , I k , a ′ ) , where a ′ at ( T ) ; if HT m ( K ′ ∪ M ′ ) = HT m ( K ′ ∪ N ′ ) then IS ′ s = IS ′ s ∪ { k } ; C = IC ( T ′ ) where T ′ ≈ T , IS n ( T ′ ) = IS n ( T ) , and IS s ( T ′ ) = IS ′ s ; return C ; else return None; Algorithm 2:
Basic Algorithm to Discover k - m - n SE-Conditions
Input: the sizes of a k - m - n problem: k , m , n Output: set of the most general SE-conditions:
MGIC MGIC = /0; IS = { k | ≤ k < ∗ ( k + m + n ) } ; for IS n ⊆ IS do C = veri f y and compute mg se ( k , m , n , IS n , IS n ) ; if C is not None then MGIC = MGIC ∪ { C } ; return MGIC ;to accomplish. In what follows, we show how to improve Algorithm 2 by further studying theproperties of S-* transformations.
MLN
In this subsection, we present four kinds of methods to improve Algorithm 2: (1) avoiding search-ing semi-valid rules, (2) avoiding searching unnecessary IS-conditions, (3) terminating searchingprocess in early stage, and (4) optimizing searching spaces.
Avoiding Searching Semi-Valid Rules. A k - m - n tuple containing semi-valid rules can beviewed as a small k ′ - m ′ - n ′ tuple containing no semi-valid rules, therefore, there is no needto check corresponding IS-conditions. By NIC ( k , m , n ) , we denote the set of all singleton IS-conditions that do not condition semi-valid rules. Here, we show how to compute NIC ( k , m , n ) for a k - m - n problem.For a tuple T of LP MLN programs and a rule r i ∈ T , an independent set I is called an I- k independent set if I ⊑ I k ( r i ) . We use IS ( k , m , n ) to denote the set of names of all independent sets Syntactic Approach to Studying Strongly Equivalent Logic Programs k - m - n problem, i.e., IS ( k , m , n ) = { i | ≤ i < ∗ ( k + m + n ) } ; and use IS k ( k , m , n ) to denotethe set of names of I- k independent sets of a k - m - n problem. By Equation (22), the sufficient andnecessary syntactic condition for non-semi-valid rules is ( I = /0 ) ∧ ( I = /0 ) ∧ ( I = /0 ) ∧ ( I = /0 ) (23)Therefore, if a k - m - n tuple T does not contain semi-valid rules, all I-3, I-6, and I-7 independentsets of T should be the empty set, i.e., I i = /0 for all i IS ′ ( k , m , n ) , where we use IS ′ ( k , m , n ) todenote the set of names of independent sets that are not I-3, I-6, and I-7 independent sets, i.e., IS ′ ( k , m , n ) = IS ( k , m , n ) − ( IS ( k , m , n ) ∪ IS ( k , m , n ) ∪ IS ( k , m , n )) . For a k - m - n problem, weuse SIC ( k , m , n ) to denote the IS-conditions that contain non-empty I-3, I-6, or I-7 independentsets, which is SIC ( k , m , n ) = { IC ( T ) ∈ IC ( k , m , n ) | IS n ( T ) IS ′ ( k , m , n ) } (24)A k - m - n singleton IS-condition IC ( T ) is called a non-semi-valid IS-condition w.r.t. I-3, I-6, andI-7 independent sets (NSV-IS-condition for short), if IC ( T ) SIC ( k , m , n ) ; and the tuple T iscalled a NSV-tuple. For example, for the 0-1-1 problem, the independent set I = I ( r ) ∩ I ( r ) ,therefore, I is an I-6 independent set. Besides, there are other 38 I-3, I-6, and I-7 independentsets for 0-1-1 problem, therefore, we only need to check 2 − = NSV-IS-conditions.In addition, by Equation (23), a k - m - n tuple T contains semi-valid rules, if there is a rule r in T such that I I ( r ) for any non-empty independent set I of T . Therefore, such kinds ofIS-conditions can be skipped in searching k - m - n SE-conditions. For a k - m - n problem, we use SIC ( k , m , n ) to denote the set of all such kinds of IS-conditions, which is SIC ( k , m , n ) = { IC ( T ) ∈ IC ( k , m , n ) | ∃ r ∈ T , ∀ I ∈ IS n ( T ) , I I ( r ) } (25)Combining above results, for a k - m - n problem, we have NIC ( k , m , n ) = IC ( k , m , n ) − ( SIC ( k , m , n ) ∪ SIC ( k , m , n )) (26) Avoiding Verifying Unnecessary IS-Conditions.
Algorithm 1 verifies a singleton IS-conditionby computing the HT-models of programs constructed from the IS-condition, which is unneces-sary for some kinds of IS-conditions. For NSV-tuples of LP
MLN programs, Theorem 9 shows thatthe S-EX-0 transformation is NSE-preserving and the S-RD-1 transformation is SE-preserving.
Theorem 9
For NSV-tuples T and T ⊕ of logic programs such that T = h P , Q i and T ⊕ = h P ⊕ , Q ⊕ i = Γ ⊕ ( T , I k , a ′ ) ,we have P s , △ Q implies P ⊕ s , △ Q ⊕ , and P ⊕ ≡ s , △ Q ⊕ implies P ≡ s , △ Q , where △ ∈ { a , s } .The proof of SE-preserving property of the S-RD-1 transformation is basically the same as theproof of Lemma 1, therefore, we omit the proof for brevity. For the S-EX-0 transformation, it isthe inverse of the S-RD-1 transformation, therefore, the NSE-preserving property of the S-EX-0transformation is a direct result of the SE-preserving property of the S-RD-1 transformation.Theorem 9 can be used to improve Algorithm 2. For an NSV-IS-conditions IC ( T ) , if IC ( T ) is not an SE-condition, by Theorem 9, arbitrary NSV-IS-condition IC ( T ′ ) such that IC ( T ) ⊂ IC ( T ′ ) cannot be an SE-condition. Therefore, there is no need to verify the HT-models of theprograms of T ′ . Since verifying HT-models is usually harder in computation, Theorem 9 canbe used to improve the efficiency of Algorithm 2. In particular, if an NSV-IS-condition ( | I k | = ) ∧ V i = k ( I i = /0 ) is not an k - m - n SE-condition, the independent set I k should be empty in all k - m - n SE-conditions, which means the searching space of a k - m - n problem can be further reduced.8 B. Wang et al.
For example, for the 0-1-1 problem, there are 8 such kind of independent sets, therefore, we onlyneed to check 2 − = NSV-IS-conditions.
Terminating Searching Processes at an Early Stage.
Algorithm 2 requires to check all IS-conditions in the whole searching space of a k - m - n problem, which is unnecessary by Theorem 9.Theorem 9 implies an early terminating criterion for a searching algorithm of the k - m - n problems,which is shown in Corollary 3. Corollary 3
For a k - m - n problem and a constant k , if all singleton IS-conditions IC ( T ) ∈ NIC ( k , m , n ) suchthat | IS n ( T ) | = k are not SE-conditions, arbitrary IS-condition IC ( T ′ ) ∈ NIC ( k , m , n ) such that | IS n ( T ′ ) | > k is not an SE-condition.According to Corollary 3, the searching space of a k - m - n problem can be divided into a seriesof subspaces, where the IS-conditions have the same numbers of non-empty independent sets ineach subspace. We use IC i ( k , m , n ) and NIC i ( k , m , n ) to denote the subspaces of the searchingspace of a k - m - n problem, which are IC i ( k , m , n ) = { IC ( T ) ∈ IC ( k , m , n ) | | IS n ( T ) | = i } (27) NIC i ( k , m , n ) = IC i ( k , m , n ) ∩ NIC ( k , m , n ) (28)A subspace is called a layer of the searching space of a k - m - n problem. According to Corollary3, we can check the IS-conditions of a k - m - n problem layer by layer. Once all IS-conditions of NIC i ( k , m , n ) are not SE-conditions, the searching process can be terminated.In addition, by Theorem 9, the k - m - n NSV-IS-condition IC ( T ) such that IS s ( T ) = IS ′ ( k , m , n ) should not be an k - m - n SE-condition. Since if IC ( T ) is an SE-condition, arbitrary k - m - n NSV-IS-condition is an SE-condition by the SE-preserving property of the S-RD-1 transformation. Inother words, if IC ( T ) is an SE-condition, arbitrary singleton k - m - n NSV-tuple of LP
MLN pro-grams is semi-strongly equivalent, which is counterintuitive.
Optimizing Searching Spaces.
In above improvements for Algorithm 2, a searching algo-rithm needs to check every NSV-IS-conditions for a k - m - n problem. Here, we show a methodto skip searching subspaces for a k - m - n problem. By Equation (26) and Theorem 9, there aretwo kinds of IS-conditions can be skipped without verifying HT-models, i.e., (1) IS-conditionsin SIC ( k , m , n ) and (2) IS-conditions related to existing non-SE-conditions.For the IS-conditions in SIC ( k , m , n ) of a k - m - n problem, we can divide the independent setsof a k - m - n problem into two subsets, i.e. the I-4 and non-I-4 independent sets. We use IS ′ ( k , m , n ) and IS ′ ( k , m , n ) to denote the set of names of I-4 and non-I-4 independent sets in IS ′ ( k , m , n ) , i.e., IS ′ ( k , m , n ) = IS ′ ( k , m , n ) ∩ IS ( k , m , n ) and IS ( k , m , n ) = IS ′ ( k , m , n ) − IS ′ ( k , m , n ) . To checkwhether a k - m - n IS-condition IC ( T ) belongs to SIC ( k , m , n ) , we only need to check the non-emtpy I-4 independent sets of T . In other words, we can skip the searching subspaces by onlychecking the I-4 independent sets of a k - m - n problem. Based on above notations, the subspace NIC x ( k , m , n ) of a k - m - n problem can be reformulated as NIC x ( k , m , n ) = { IC ( T ) | IS s ( T ) = IS s ( T ) ∪ IS s ( T ) , | IS s ( T ) | = x , IC ( T ) ∈ NIC x ( k , m , n ) , and IS s ( T ) ⊆ IS ′ ( k , m , n ) } (29)where the set NIC x ( k , m , n ) of singleton IS-conditions is defined as { IC ( T ) | < | IS s ( T ) | ≤ x , IS s ( T ) ⊆ IS ′ ( k , m , n ) , and ∀ r ∈ T , ∃ i ∈ IS s ( T ) , I i ⊑ I ( r ) } (30)By Equation (29) and (30), the k - m - n searching subspaces such that IC ( T ) NIC x ( k , m , n ) can Syntactic Approach to Studying Strongly Equivalent Logic Programs k - m - n Problems | IS | | IS ′ | | IS ′′ | T R | MGIC | |
MNSE | Max
Alg. 2 Alg. 30-1-0 7 n/a n/a 7 120 1 1 < ≤ ≥ ≥ be simply skipped. Meanwhile, a layer of the searching space is divided into several small sub-spaces by Equation (30), which can be searched in parallel.Following the same method, the searching space can be further optimized by existing non-SE-conditions. Suppose the k - m - n singleton IS-condition IC ( T ′ ) is not an k - m - n SE-condition, byTheorem 9, a k - m - n searching subspace NIC x ( k , m , n ) such that x > | IS s ( T ′ ) | can be reduced to NIC x ( k , m , n ) = { IC ( T ) | IS s ( T ) = IS s ( T ) ∪ IS s ( T ) , | IS s ( T ) | = x , IS s ( T ) ( IS s ( T ′ ) , and IS s ( T ) ⊆ IS ′ ( k , m , n ) − IS s ( T ′ ) } (31)For a set of non-SE-conditions, a searching algorithm can repetitively use Equation (31) for eachnon-SE-conditions in the set. Since the relation ⊂ between singleton IS-conditions is transitive,in above methods, a searching algorithm only need to retain the minimal non-SE-conditions inthe sense of the relation ⊂ .Combining above four kinds of improvements methods, an improved method to automaticallysearch k - m - n SE-conditions is shown in Algorithm 3. In Line 13, we use a triple S = h ISL , IS , i −| ISL |i to record a searching subspace. The set IC S of singleton IS-conditions in the subspace S is IC S = { IC ( T ) | ISR ⊆ IS , | ISR | = i − | ISL | , and IS s ( T ) = ISR ∪ ISL } (32)In Line 16 - 26, we use S [ i ] ( ≤ i ≤ ) to denote the i -th element of the subspace triple S . In whatfollows, we use MGIC ( k , m , n ) and MNSE ( k , m , n ) to denote the sets of the k - m - n SE-conditionsand the minimal k - m - n non-SE-conditions discovered by Algorithm 3, respectively. Now we compare the running times of Algorithm 2 and 3 in solving k - m - n problems such that k + m + n ≤
3. The algorithms were carried out on three servers with Intel Xeon E5-2687W CPUand 100 GB RAM running Ubuntu 16.04 .Table 4 shows the running records of Algorithm 2 and 3, where the columns Alg. 2 and Alg.3 show the running times of solving a k - m - n problem via using Algorithm 2 and Algorithm 3respectively, other columns show some important data in Algorithm 3, which are as follows • | IS | (Line 2) is the number of the independent sets w.r.t. a k - m - n problem; An implementation of the searching algorithms and the discovered SE-conditions can be found at https://github.com/wangbiu/lpmln_isets . B. Wang et al.
Algorithm 3:
Improved Algorithm to Discover k - m - n SE-Conditions
Input: the sizes of a k - m - n problem: k , m , n Output: set of the most general SE-conditions:
MGIC , terminating layer:
T R MGIC = /0, MNSE = /0 ; // eliminating I-3, I-6, I-7 independent sets IS = IS ( k , m , n ) , IS ′ = IS − ( IS ( k , m , n ) ∪ IS ( k , m , n ) ∪ IS ( k , m , n )) , IS ′′ = /0; // eliminating searching spaces related to non-SE-conditions for x ∈ IS ′ do C = veri f y and compute mg se ( k , m , n , { x } , { x } ) ; if C is not None then IS ′′ = IS ′′ ∪ { x } ; IS = IS ′′ ∩ IS ( k , m , n ) , IS = IS ′′ − IS ; for ≤ i ≤ | IS ′′ | do // searching IS-conditions layer by layer Space = /0, MGIC i = /0; // eliminating searching spaces related to semi-valid rules for ISL ⊆ IS s.t. | ISL | ≤ i do construct a singleton k - m - n tuple T s.t. IS s ( T ) = ISL ; if ∀ r ∈ T , ∃ I ∈ IS s ( T ) , I ⊑ I ( r ) then Space = Space ∪ {h
ISL , IS , i − | ISL |i} ; // eliminating searching spaces related to non-SE-conditions for IC ( T ′ ) ∈ MNSE do Space ′ = /0; for sp ∈ Space do IS ′ = IS s ( T ′ ) − sp [ ] ; if IS ′ ⊆ sp [ ] then for ISL ′ ( IS ′ s.t. | ISL ′ | ≤ sp [ ] do Space ′ = Space ′ ∪ {h sp [ ] ∪ ISL ′ , sp [ ] − IS ′ , sp [ ] − | ISL ′ |i} ; else Space ′ = Space ′ ∪ { sp } ; Space = Space ′ ; for sp ∈ Space do // verifying IS-conditions by computing HT-models for ISR ⊆ sp [ ] s.t. | ISR | = sp [ ] do C = veri f y and compute mg se ( k , m , n , sp [ ] ∪ ISR , sp [ ] ∪ ISR ) ; if C is not None then MGIC i = MGIC i ∪ { C } ; else Max = | IS s ( T ) | , MNSE = MNSE ∪ { C } ; MGIC = MGIC ∪ MGIC i ; if MGIC i = /0 then // early terminating criterion T R = i , return MGIC , MNSE , T R , Max ; Syntactic Approach to Studying Strongly Equivalent Logic Programs • | IS ′ | (Line 2) is the number of non-I-3, non-I-4, and non-I7 independent sets of IS ; • | IS ′′ | (Line 6) is the number of independent sets of IS ′ that can construct k - m - n SE-conditions; • T R (Line 33) is the terminating layer of a k - m - n problem, i.e. for any k - m - n IS-condition IC ( T ) such that | IS s ( T ) | = T R , IC ( T ) is not a k - m - n SE-condition; • |
MGIC | (Line 31) is the number of the most general SE-conditions of a k - m - n problem; • | MNSE | (Line 30) is the number of the minimal non-SE-conditions of a k - m - n problem; • Max (Line 30) is the maximal number of singleton independent sets w.r.t. a minimal non-SE-condition, i.e.
Max = | IS s ( T ) | , where IC ( T ) ∈ MNSE and for any IC ( T ′ ) ∈ MNSE , | IS s ( T ′ ) | ≤ | IS s ( T ) | .Note that for the k - m - n problems such that k + m + n >
2, the set IS ′ does not contain I-5 inde-pendent sets, which is an application of the 0-1-1 SE-conditions. For the k - m - n problems suchthat k + m + n >
1, their searching spaces in Algorithm 2 are constructed from IS ′ , since originalAlgorithm 2 can only be used to solve the 0-1-0 problem.For the 2-1-0 problem, there are too many IS-conditions that need to be verified. And forthe IS-conditions consisting of more than 20 non-empty independent sets, it usually takes a verylong time to verify them by using Algorithm 1. Therefore, for 2-1-0 singleton IS-condition IC ( T ) such that | IS s ( T ) | >
3, we skip the verification, which means there are at most 249913344 2-1-0SE-conditions and at least 984 minimal 2-1-0 non-SE-conditions. Except for the 2-1-0 problem,the other k - m - n problems in Table 4 are called verified k - m - n problems.For the verified k - m - n problems, Algorithm 3 can be done in a reasonable amount of time, andcorresponding SE-conditions are reported in next section. k - m - n Problems
In this section, we report the discovered SE-conditions of the verified k - m - n problems. Firstly,we present a preliminary approach to simplifying the SE-conditions. Secondly, we report thesimplified SE-conditions of the verified k - m - n problems. Finally, we present a discussion on thediscovered k - m - n SE-conditions. k - m - n SE-conditions
As shown in Table 4, there are many SE-conditions of a k - m - n problem, which is not conve-nient in practical use. For the 0-1-0 problem, Equation (22) shows that the discovered 120 SE-conditions can be simplified, which is simplified by a symbolic computing toolkit such as SymPy(Meurer et al. 2017). But for other k - m - n problems, there are too many symbols in SE-conditions,which makes SymPy not applicable. Therefore, we need to study how to simplify SE-conditionsof a k - m - n problem.For a set IC of k - m - n SE-conditions, by
CIS e ( IC ) and CIS n ( IC ) , we denote the set of namesof common empty and non-empty independent sets of the conditions in IC , respectively, whichare CIS △ ( C ) = \ IC ( T ) ∈ C IS △ ( T ) , where △ ∈ { e , n } (33)The notion of clique for a set of k - m - n SE-conditions is defined as follows.2
B. Wang et al.Definition 11 ( Clique )A set IC of k - m - n SE-conditions is called a clique, if both of the following conditions are satisfied • there is an SE-condition IC ( T ) of IC such that for any other SE-condition IC ( T ′ ) of IC , IS n ( T ′ ) ( IS n ( T ) and IS s ( T ′ ) = IS n ( T ′ ) ∩ IS s ( T ) ; • | IC | = x , where x = | IS ( k , m , n ) | − | CIS e ( IC ) | − | CIS n ( IC ) | .And the SE-condition IC ( T ) is called the max-SE-condition of IC .For a clique IC of k - m - n SE-conditions and its max-SE-condition IC ( T ) , it is easy to check thatthe clique IC can be simplified as Sim ( IC ) = ^ i ∈ CIS n ( IC ) ( I i = /0 ) ∧ ^ j ∈ CIS e ( IC ) ( I j = /0 ) ∧ ^ k ∈ IS s ( T ) ( | I k | ≤ ) (34)A clique IC of k - m - n SE-conditions is called a maximal clique of
MGIC ( k , m , n ) , if IC ⊆ MGIC ( k , m , n ) and there does not exist a clique such that IC ′ ⊆ MGIC ( k , m , n ) and IC ( IC ′ . Based on the abovenotions, simplifying k - m - n SE-conditions of
MGIC ( k , m , n ) is turned into finding the maximalcliques of MGIC ( k , m , n ) . For a k - m - n problem, by MC ( k , m , n ) , we denote the set of maximalcliques of MGIC ( k , m , n ) , the simplified k - m - n SE-condition is _ IC ∈ MC ( k , m , n ) Sim ( IC ) (35) Example 7
Consider following SE-conditions ( I = /0 ) ∧ ( I = /0 ) ∧ ( I = /0 ) (IC1) ( I = /0 ) ∧ ( I = /0 ) ∧ ( I = /0 ) (IC2) ( I = /0 ) ∧ ( I = /0 ) ∧ ( I = /0 ) (IC3)It is easy to check that there are two maximal cliques in the above three SE-conditions, i.e. MC = { IC , IC } and MC = { IC , IC } . Therefore, the simplified SE-condition is ( I = /0 ) ∧ (( I = /0 ) ∨ ( I = /0 )) (36)Usually, some k - m - n SE-conditions in
MGIC ( k , m , n ) consist of singleton independent sets, by IC s ( k , m , n ) , we denote the set of names of singleton independent sets of all k - m - n SE-conditions,which is IC s ( k , m , n ) = [ IC ( T ) ∈ MGIC ( k , m , n ) IS s ( T ) (37)A subset IC of MGIC ( k , m , n ) is called singleton independent set irrelevant (SIS-irrelevant forshort), if one of following conditions is satisfied • for any SE-condition IC ( T ) ∈ IC , IS s ( T ) = /0; or • for any SE-condition IC ( T ) ∈ IC , IS n ( T ) ∩ IC s ( k , m , n ) = IS s ( T ) .It is easy to check that only an SIS-irrelevant subset of MGIC ( k , m , n ) could be a clique. There-fore, to simplify the k - m - n SE-conditions, we divide the set
MGIC ( k , m , n ) into several maximalSIS-irrelevant subsets. For each maximal SIS-irrelevant subset of MGIC ( k , m , n ) , Algorithm 4provides a preliminary method to find maximal cliques of the subset. Syntactic Approach to Studying Strongly Equivalent Logic Programs Algorithm 4:
Finding Maximal Cliques
Input:
An SIS-irrelevant subset of
MGIC ( k , m , n ) : IC Output:
Maximal Cliques of IC : MaxCliques MaxIC = { IC ( T ) ∈ IC | ∀ IC ( T ′ ) ∈ IC , IS n ( T ) IS n ( T ′ ) } , Cliques = /0; for IC ( T ) ∈ MaxIC do IC ′ = { IC ( T ′ ) ∈ IC | IS n ( T ′ ) ⊆ IS n ( T ) } , NIS = S IC ( T ′ ) ∈ IC ′ IS n ( T ′ ) , IC ′′ = /0; for NIS ′ ( NIS do CQ = { IC ( T ′ ) ∈ IC ′ | NIS ′ ⊆ IS n ( T ′ ) } , CQ = { IC ( T ′ ) ∈ IC ′ | NIS ′ ⊆ IS e ( T ′ ) } ; for ≤ i ≤ do MaxIC ′ = { IC ( T ′ ) ∈ IC ′ | ∀ IC ( T ′′ ) ∈ IC ′ , IS n ( T ′ ) IS n ( T ′′ ) } ; for IC ( T ′ ) ∈ MaxIC ′ do CQ ′ i = { IC ( T ′′ ) ∈ CQ i | IS n ( T ′′ ) ⊆ IS n ( T ′ ) } ; if CQ ′ i is a clique then Cliques = Cliques ∪ { CQ ′ i } , IC ′′ = IC ′′ ∪ CQ ′ i ; if IC ′ ⊆ IC ′′ then break; MaxCliques = { CQ ∈ Cliques | ∀ CQ ′ ∈ Cliques , CQ CQ ′ } ; return MaxCliques ; k - m - n SE-Conditions
Now we report the simplified SE-conditions of the verified k - m - n problems . For the 0-1-1 and 1-1-0 problems, we report the simplified SE-conditions such that I-3, I-6, and I-7 independent setsare empty. Let IS = { , , , , , } and IS = IS ∪ { , , , , } , the simplifiedSE-condition of the 0-1-1 problem is ( I = /0 ) ∧ ^ k ∈ IS ( , , ) − IS ( I k = /0 ) (38)and the simplified SE-condition of the 1-1-0 problem is ( I = /0 ) ∧ ^ k ∈ IS ( , , ) − IS ( I k = /0 ) (39)For the 0-2-1, 1-2-0, and 1-1-1 problems, we report the simplified SE-conditions such that I-3,I-5, I-6, and I-7 independent sets are empty. Let IS = { , , , , , , , , } ,the simplified SE-condition of the 0-2-1 problem is (cid:0) IC ∨ IC (cid:1) ∧ ( I = /0 ) ∧ ^ k ∈ IS ( , , ) − IS ( I k = /0 ) (40)where the formulas IC and IC are IC = ( I = /0 ) ∧ ( I = /0 ) ∧ ( I = /0 ) (41) IC = ( I = /0 ) ∧ ( I = /0 ) ∧ ( I = /0 ) (42) The discovered and simplified SE-conditions can be found at https://github.com/wangbiu/lpmln_isets/tree/master/experimental-results/lpmln-se-conditions . B. Wang et al.
Let IS = { , , , , , , , , , , , , , } , the simplified SE-condition ofthe 1-2-0 problem is (( I = /0 ) ∨ (( I = /0 ) ∧ ( I = /0 ) ∧ ( I = /0 ))) ∧ ^ k ∈ IS ( , , ) − IS ( I k = /0 ) (43)For the 1-1-1 problem, there are 19 maximal cliques of MGIC ( , , ) . For brevity, we onlyshow the simplified SE-conditions containing singleton independent sets. Let IS = { , , , , , , , } , the simplified SE-conditions containing singleton independent sets are | I | ≤ ∧ ( I = /0 ) ∧ ( I = /0 ) ∧ V e ∈ IS ( , , ) − IS ( I e = /0 ) (44) ( I = /0 ) ∧ | I | ≤ ∧ ( I = /0 ) ∧ V e ∈ IS ( , , ) − IS ( I e = /0 ) (45) In this subsection, we present a discussion for discovered k - m - n SE-conditions from three as-pects: (1) the max-min k - m - n non-SE-conditions; (2) the most general k - m - n SE-conditions con-taining singleton independent sets ( k - m - n MGS-SE-conditions for short); and (3) the simplifica-tions of k - m - n SE-conditions.
About the Max-Min Non-SE-Conditions and the MGS-SE-Conditions.
From the verified k - m - n problems and the verified 2-1-0 SE-conditions, there are two interesting facts w.r.t. themax-min k - m - n non-SE-conditions and the k - m - n MGS-SE-conditions, which are shown in Fact1 and 2.
Fact 1
For a max-min non-SE-condition IC ( T ) of a verified k - m - n problem, it can be observed that | IS s ( T ) | = k + m + n . Fact 2
For an MGS-SE-condition IC ( T ) of a verified k - m - n problem such that IC ( T ) ∈ MGIC ( k , m , n ) and | IS n ( T ) | > I i such that i ∈ IS s ( T ) , there exists an MGS-SE-condition IC ( T ′ ) such that IC ( T ′ ) ∈ MGIC ( k , m , n ) , i ∈ IS s ( T ′ ) , and | IS n ( T ′ ) | = k - m - n problems, there is a major improvement for the searching algorithms of k - m - n problems.By Fact 1, the singleton non-SE-conditions of a k - m - n problem can be obtained by verifying asmall amount of IS-conditions. Specifically, the set MNSE ( k , m , n ) can be directly computed byEquation (46). MNSE ( k , m , n ) = { IC ( T ) ∈ NIC x ( k , m , n ) | ≤ x ≤ k + m + n , T = h K , M , N i , and HT m ( K ∪ M ) = HT m ( K ∪ N ) } (46)For other IS-conditions IC ( T ) ∈ NIC x ( k , m , n ) such that x > k + m + n , by the NSE-preservingproperty of the S-EX-0 transformation, if there is an IS-condition IC ( T ′ ) ∈ MNSE ( k , m , n ) suchthat IS s ( T ′ ) ( IS s ( T ) , IC ( T ) is not an SE-condition; otherwise, IC ( T ) is an SE-condition. By MGIC ′ ( k , m , n ) , we denote the set of k - m - n singleton SE-conditions IC ( T ) such that | IS s ( T ) | > k + m + n , we have MGIC ′ ( k , m , n ) = { IC ( T ) ∈ NIC x ( k , m , n ) | x > k + m + n and ∀ IC ( T ′ ) ∈ MNSE ( k , m , n ) , IS s ( T ′ ) IS s ( T ) } (47) Syntactic Approach to Studying Strongly Equivalent Logic Programs IC ( T ) such that | IS n ( T ) | =
2. By
SIS ( k , m , n ) ,we denote the set of names of such kind of independent sets, we have SIS ( k , m , n ) = { i | IC ( T ) ∈ NIC ( k , m , n ) ∩ MGIC ( k , m , n ) and i ∈ IS s ( T ) } (48)Combining the above facts, for a singleton IS-condition IC ( T ) ∈ MGIC ′ ( k , m , n ) , the MGS-SE-condition MGIC ( T ′ ) w.r.t. IC ( T ) can be constructed as follows MGIC ( T ′ ) = ^ i ∈ IS n ( T ) ( I i = /0 ) ∧ ^ e ∈ IS e ( T ) ( I e = /0 ) ∧ ^ s ∈ IS n ( T ) ∩ SIS ( k , m , n ) | I s | = k - m - n problems such that k + m + n >
2, the IS-conditions in
MGIC ′ ( k , m , n ) need not be verified by Algorithm 1. Since Algorithm 1 is the hardest part of the searching algo-rithms of k - m - n problems, if Fact 1 and 2 are true in any k - m - n problems, the above discussionimplies a major improvement for these searching algorithms.On the other hand, Fact 1 and 2 essentially imply the NSE-preserving property of the S-RD-1transformation and the SE-preserving property of the S-EX-0 transformation under some un-known conditions. Assume under a condition C , the S-RD-1 transformation is NSE-preserving.Since the S-EX-0 transformation is the inverse of the S-RD-1 transformation, the S-EX-0 trans-formation is SE-preserving under the condition C . We call the properties C -NSE-preserving and C -SE-preserving properties, respectively.For a singleton IS-conditions IC ( T ) ∈ MGIC ′ ( k , m , n ) , since for any singleton IS-condition IC ( T ′ ) ∈ NIC ( k , m , n ) such that IC ( T ′ ) ⊂ IC ( T ) , IC ( T ′ ) is an SE-condition, by the C -SE-preservingproperty of the S-EX-0 transformation, IC ( T ) should be an SE-condition. Therefore, Fact 1 isderived from the C -SE-preserving property of the S-EX-0 transformation.For a k - m - n MGS-SE-condition IC ( T ) and an independent set I i such that i ∈ IS s ( T ) , we canconstruct a k - m - n singleton tuple T ′ such that IC ( T ′ ) < IC ( T ) , and let T ′⊕ = Γ ⊕ ( T , I i , a ′ ) . It iseasy to check that T ′ is semi-strongly equivalent but T ′⊕ is not. For a singleton IS-condition IC ( T ′′ ) ∈ NIC ( k , m , n ) such that IC ( T ′′ ) ⊂ IC ( T ′ ) and i ∈ IS s ( T ′′ ) , by the SE-preserving prop-erty of the S-RD-1 transformations, it is easy to check that IC ( T ′′ ) is an SE-condition. And let T ′′⊕ = Γ ⊕ ( T ′′ , I i , a ′ ) , by the C -NSE-preserving property of the S-RD-1 transformation, we have T ′′⊕ is not semi-strongly equivalent, i.e., IC ( T ′′ ) is not an SE-condition. Therefore, Fact 2 isderived from the C -NSE-preserving property of the S-RD-1 transformation.The above discussion show the C -NSE-preserving and C -SE-preserving properties may pro-vide more understandings of the semi-strong equivalence of LP MLN and provide a major im-provement for the searching algorithms of k - m - n problems. However, it is still an open problemwhether the C -NSE-preserving and C -SE-preserving properties hold. About Simplifications of the SE-conditions.
In this paper, although we have presented apreliminary algorithm to simplify k - m - n SE-conditions, there are still many problems on thesimplifications of the SE-conditions.Firstly, Algorithm 4 may not find the simplest k - m - n SE-conditions. Since the approach canonly process IS-conditions, while the simplest SE-condition may not be an IS-condition. Asshown in Equation (5), the simplest 0-1-0 SE-condition of LP
MLN programs is not a disjunctionof IS-conditions. But we can only obtain the 0-1-0 SE-condition shown in Equation (22) byAlgorithm 4.Secondly, the optimizing approaches used in Algorithm 3 make the discovered SE-conditionsnot easy to simplify. Specifically, we define the proper subset
MGIC max ( k , m , n ) of MGIC ( k , m , n ) B. Wang et al. as follows
MGIC max ( k , m , n ) = { IC ( T ) ∈ MGIC ( k , m , n ) | IS s ( T ) = /0 and ∀ IC ( T ′ ) ∈ MGIC ( k , m , n ) , IS n ( T ) IS n ( T ′ ) } (50)By the SE-preserving property of the S-RD-1 transformation, there should be a maximal cliquew.r.t. each SE-condition of MGIC max ( k , m , n ) , i.e., for an SE-condition IC ( T ) ∈ MGIC max ( k , m , n ) ,the set IC = { IC ( T ′ ) ∈ MGIC ( k , m , n ) | IS n ( T ′ ) ⊆ IS n ( T ) } should be a maximal clique. But sincethe IS-conditions containing semi-valid rules are skipped in the searching processes, these con-ditions do not occur in MGIC ( k , m , n ) , i.e., the set IC is usually not a maximal clique.In addition, the rules in a tuple are allowed to be the same in this paper. Although the search-ing algorithms may be improved by skipping the IS-conditions containing the same rules, itwould make the simplified SE-conditions more complex. For example, if we eliminate the SE-conditions containing the same rules, the simplified 0-1-1 SE-condition is turned into ( I = /0 ) ∧ (( I = /0 ) ∨ ( I = /0 )) ∧ ^ k ∈ IS ( , , ) − IS ( I k = /0 ) (51)Obviously, it is more complex than the 0-1-1 SE-condition in Equation (39).Combining the above discussion, how to optimize the searching algorithms of k - m - n problemsand simplify discovered SE-conditions are still open problems, which would be a future work ofthe paper. Lin and Chen (2007) have presented an approach to discovering the k - m - n SE-conditions of ASPprograms. In this section, we compare the Lin and Chen’s approach (LC-approach for short)with our independent sets approach (IS-approach for short). Firstly, both of the approaches arepresented to discover the k - m - n SE-conditions of logic programs. For the IS-approach, we haveshown that it can be used in both ASP and LP
MLN . And for the LC-approach, although it is onlyused in ASP, it is not difficult to adapt the approach to LP
MLN , which is shown in what follows.Secondly, we show the differences between the LC-approach and the IS-approach. In the LC-approach, there are four main steps to discover necessary k - m - n SE-conditions: • G-step: choose a small set of atoms and generate all strongly equivalent k - m - n tuples con-structed from the set; • C-step: conjecture a plausible k - m - n syntactic condition manually; • V -step: verify the conjecture in the generated k - m - n tuples automatically; • V -step: verify the conjecture in the general cases manually.In the C-step, the LC-approach has to conjecture a syntactic condition manually, since theredoes not exist a general theorem that guarantees the forms of SE-conditions. In the V step, theLC-approach can automatically verify the conjecture in the generated k - m - n tuples, since thestrong equivalence checking of ASP can be reduced to the tautology checking of a propositionalformula. In the V step, the LC-approach need to show the conjecture holds for arbitrary k - m - n tuples, where the necessary part of the verification cannot be done automatically. A main reasonis that the forms of SE-conditions are unknown. It is obvious that, to adapt the LC-approach toLP MLN , we only need to consider the V step. In other words, we need to find a reduction fromthe semi-strong equivalence checking of LP MLN to the tautology checking of a propositional
Syntactic Approach to Studying Strongly Equivalent Logic Programs
MLN .In the IS-approach, there are only two steps to discover necessary SE-conditions: • G-Step: generate an IS-condition of a k - m - n problem; • V-Step: verify whether the IS-condition is a k - m - n SE-condition and compute the mostgeneral SE-condition.For a k - m - n problem, there are finitely many IS-conditions and each IS-condition can be verifiedby comparing the HT-models of related programs, which can be done automatically. Since wehave shown that the form of SE-conditions is exactly the form of the IS-conditions, the discoveredSE-conditions are straightforwardly necessary.According to the above comparison, the main advantage of the IS-approach is it is a fullyautomatic approach, and it can be easily adapted to other logic formalisms by studying the SE-preserving and NSE-preserving properties of S-* transformations in corresponding logic for-malisms. In this paper, we present a syntactic approach to study the strong equivalences of ASP and LP
MLN programs. Firstly, we present the notions of independent set and S-* transformations and showthe SE-preserving and NSE-preserving properties of S-* transformations. Secondly, we presenta basic algorithm to discover k - m - n SE-conditions of logic programs, which is a fully automaticapproach. To discover the SE-conditions efficiently, we present four kinds of improvements forthe algorithm. Due to the same properties of S-* transformations in LP
MLN and ASP, the dis-covering approaches can be used in ASP directly. Thirdly, we present a maximal-cliques-basedmethod to simplify the discovered k - m - n SE-conditions and report the simplified 0-1-0, 0-1-1,1-1-0, 0-2-1, 1-2-0, and 1-1-1 SE-conditions. Moreover, we present a discussion on two interest-ing facts in the discovered SE-conditions and the problems in simplifications of SE-conditions.Finally, we present a comparison between Lin and Chen’ and our approaches to discoveringSE-conditions and discuss the similarity and differences between the notions of S-DL, S-RD,and HT-forgetting. By contrast, our approach is a fully automatic approach and is easy to adaptto other logic formalisms. A main problem of our approach is there are too many discoveredSE-conditions, but we have not found a good method to simplify these SE-conditions.For the future, we will continue to study the properties of S-* transformations and IS-conditions.Firstly, we will investigate whether the C -SE-preserving property of S-EX-0 and C -NSE-preservingproperty of S-RD-1 hold in any k - m - n problems of LP MLN . Secondly, we will continue to studythe simplifications of k - m - n SE-conditions. Thirdly, we will investigate why the singleton inde-pendent sets are necessary to construct an SE-condition.In addition, we will investigate the applications of the independent sets and S-* transforma-tions in other aspects of logic programming. We believe the notions of independent sets and S-*transformations will present some new perspective for studying theoretical properties of logicprograms. For example, the forgetting is to hide (delete) irrelevant information from a logic pro-gram, and HT-forgetting can preserve strong equivalence after the hiding (Wang et al. 2014). Itis easy to observe that the notion of HT-forgetting is similar to the notions of S-RD and S-DLtransformations, that is, both of the notions are used to delete information from logic programsand the deleting preserves strong equivalence.8
B. Wang et al.
We are grateful to the anonymous referees for their useful comments on the earlier version of thispaper. The work was supported by the National Key Research and Development Plan of China(Grant No.2017YFB1002801).
References C ABALAR , P.
AND F ERRARIS , P. 2007. Propositional theories are strongly equivalent to logic programs.
Theory and Practice of Logic Programming 7,
6, 745–759.E
ITER , T., F
INK , M., T
OMPITS , H.,
AND W OLTRAN , S. 2004. Simplifying Logic Programs Under Uni-form and Strong Equivalence. In
Proceedings of the 7th International Conference on Logic Programmingand Nonmonotonic Reasoning . 87–99.G
ELFOND , M.
AND L IFSCHITZ , V. 1988. The Stable Model Semantics for Logic Programming. In
Pro-ceedings of the Fifth International Conference and Symposium on Logic Programming , R. A. Kowalskiand K. A. Bowen, Eds. MIT Press, 1070–1080.J I , J. 2015. Discovering Classes of Strongly Equivalent Logic Programs with Negation as Failure in theHead. In Proceedings of the 8th International Conference on Knowledge Science, Engineering andManagement . 147–153.J I , J., W AN , H., H UO , Z., AND Y UAN , Z. 2015. Simplifying a logic program using its consequences. In
Proceedings of the 24th International Joint Conference on Artificial Intelligence . 3069–3075.L EE , J. AND L UO , M. 2019. Strong Equivalence for LP MLN
Programs. In
Proceedings of the 35th Inter-national Conference on Logic Programming . Vol. 306. 196–209.L EE , J. AND W ANG , Y. 2016. Weighted Rules under the Stable Model Semantics. In
Proceedings of theFifteenth International Conference on Principles of Knowledge Representation and Reasoning: , C. Baral,J. P. Delgrande, and F. Wolter, Eds. AAAI Press, 145–154.L
IFSCHITZ , V., P
EARCE , D.,
AND V ALVERDE , A. 2001. Strongly equivalent logic programs.
ACM Trans-actions on Computational Logic 2, IN , F. 2018. Machine theorem discovery. AI Magazine 39,
2, 53–59.L IN , F. AND C HEN , Y. 2007. Discovering Classes of Strongly Equivalent Logic Programs.
Journal ofArtificial Intelligence Research 28 , 431–451.M
EURER , A., S
MITH , C. P., P
APROCKI , M., ˇC
ERT ´ IK , O., K IRPICHEV , S. B., R
OCKLIN , M., K
UMAR ,A. T., I
VANOV , S., M
OORE , J. K., S
INGH , S., R
ATHNAYAKE , T., V IG , S., G RANGER , B. E., M
ULLER ,R. P., B
ONAZZI , F., G
UPTA , H., V
ATS , S., J
OHANSSON , F., P
EDREGOSA , F., C
URRY , M. J., T
ERREL ,A. R., R OU ˇ CKA , ˇS., S
ABOO , A., F
ERNANDO , I., K
ULAL , S., C
IMRMAN , R.,
AND S COPATZ , A. 2017.SymPy: Symbolic computing in python.
PeerJ Computer Science 2017,
1, 1–27.O
SORIO , M., N
AVARRO , J. A.,
AND A RRAZOLA , J. 2002. Equivalence in Answer Set Programming.In
Proceedings of 11th International Workshop on Logic-Based Program Synthesis and Transformation .57–75.R
ICHARDSON , M.
AND D OMINGOS , P. 2006. Markov logic networks.
Machine Learning 62,
URNER , H. 2001. Strong Equivalence for Logic Programs and Default Theories (Made Easy). In
Proceed-ings of the 6th International Conference on Logic Programming and Nonmonotonic Reasoning . 81–92.W
ANG , B., S
HEN , J., Z
HANG , S.,
AND Z HANG , Z. 2019a. On the Strong Equivalences for LP
MLN
Pro-grams (Under Reviewing). 1–44.W
ANG , B., S
HEN , J., Z
HANG , S.,
AND Z HANG , Z. 2019b. On the Strong Equivalences of LP
MLN
Pro-grams. In
Proceedings of the 35th International Conference on Logic Programming . Vol. 306. 114–125.W
ANG , K.
AND Z HOU , L. 2005. Comparisons and computation of well-founded semantics for disjunctivelogic programs.
ACM Transactions on Computational Logic 6,
2, 295–327.W
ANG , Y., Z
HANG , Y., Z
HOU , Y.,
AND Z HANG , M. 2014. Knowledge forgetting in answer set program-ming.
Journal of Artificial Intelligence Research 50,
1, 31–70.
Syntactic Approach to Studying Strongly Equivalent Logic Programs W ONG , K.-S. 2008. Sound and Complete Inference Rules for SE-Consequence.